Commit Graph

461 Commits

Author SHA1 Message Date
Joffrey JAFFEUX 52672b9eab
DEV: apply new coding standards (#10592) 2020-09-04 13:42:47 +02:00
Robin Ward 3a46e44ed8 Rename `merge` to `deepMerge` so it's more clear what it's doing 2020-09-03 10:03:33 -04:00
Robin Ward c4079780be REFACTOR: Remove `_.merge` 2020-09-03 10:03:33 -04:00
Robin Ward ff4de97dfd
REFACTOR: Move `bootbox` to an import instead of global variable (#10533) 2020-08-26 12:57:13 -04:00
Gerhard Schlager dac0e5b3cc
Merge pull request #10519 from gschlager/get-url
Fixes for getURL() in subfolders and basePath in translations
2020-08-25 11:42:50 +02:00
Martin Brennan ef461ffd60
FIX: Make sure user preference to open external links in new tab works for bookmark list excerpts (#10409)
Meta post: https://meta.discourse.org/t/bookmark-page-does-not-respect-open-all-external-links-in-new-tab-user-preference/160118
2020-08-13 14:56:13 +10:00
jbrw 6391db5921
FIX: use correct site setting when uploading images 2020-08-11 18:13:55 -04:00
Joffrey JAFFEUX 510eaf9881
DEV: re-enable tests following the timeout fix (#10410)
The 3 skipped tests are failing but not related to timeout
2020-08-11 09:09:21 +02:00
jbrw 3593e582a3
FIX - limit number of embedded media items in a post (#10391)
* FIX - limit number of embedded media items in a post

* Add renamed settings to DeprecatedSettings
2020-08-07 12:08:59 -04:00
Vinoth Kannan aa017f276f FIX: replace `fullPath` while rewriting the `/my/` URLs.
And added the tests. Follow-up to cdca5a2ee4
2020-08-05 23:22:15 +05:30
Robin Ward 92b26ecbfb REFACTOR: Move Page title / focus / counts logic to service
We had a handful of methods attached to the root `Discourse` object
related to focus and notification counts.

This patch pulls them out into a service called `document-title` for
updating the title, and a component called `d-document` to attach
and listen for browser events related to focus.

It also removes some computed properties and observers in favor of plain
old Javascript objects.
2020-08-04 12:02:25 -04:00
Robin Ward 01a3fa1ca8 REFACTOR: Remove `Discourse.__container__` from tests 2020-07-28 14:58:31 -04:00
Krzysztof Kotlarek e0d9232259
FIX: use allowlist and blocklist terminology (#10209)
This is a PR of the renaming whitelist to allowlist and blacklist to the blocklist.
2020-07-27 10:23:54 +10:00
Robin Ward f8aa304c7d REFACTOR: Remove `Discourse.SiteSettings` from uploads.js
This involves passing the siteSettings around, which is somewhat error
prone so I tried to be careful.
2020-07-24 09:45:55 -04:00
Robin Ward c4d5c0c91b REFACTOR: Remove `Discourse.SiteSettings` from utilities
This involves a little refactoring of how our `defaultHomepage()` works.
It previously would check the meta tag / site settings each time it was
called but now it only checks once on application boot.
2020-07-24 09:45:55 -04:00
Robin Ward 939fae3500 REFACTOR: Remove `Discourse.SiteSettimgs` from @setting decorator 2020-07-22 13:27:57 -04:00
Martin Brennan 62f2e1f971
FIX: Stop double prepending of window.location.origin on media URLs (#10275)
This fixes an issue where sometimes when composing a post and uploading a video/audio file, _loadCachedShortUrls/the uploads controller would return a full URL with origin, instead of just the URL with the host e.g. http://localhost:3000/some/video.mp4 instead of just //localhost:3000/some/video.mp4. We were prepending window.location.origin onto the URL no matter what, and since http://localhost:3000/some/video.mp4 does not match the host URL regex, we were ending up with something like http://localhost:3000http://localhost:3000/some/video.mp4 which broke composer previews. This was only noticed with a video upload in a secure upload environment.
2020-07-22 09:23:55 +10:00
Penar Musaraj 0f6405745a
DEV: re-enable test skipped in 7dce4bfd
Leak in lib:sharing tests was the likely cause of failure.
2020-07-20 09:55:30 -04:00
Jarek Radosz de79f19947
Revert "UX: Style video elements, show descriptions (#10040)" (#10258)
This reverts commit 7d289a4f3e.

Now that 36bad0c31f is in and we have video previews on all platforms, the commit that's being reverted is no longer needed. In the worst case scenario, the video description is clipped under the video poster if the video aspect ratio is other than 16:9. This commit removes descriptions and the custom style for the video elements.

# Conflicts:
#	app/assets/javascripts/pretty-text/addon/engines/discourse-markdown-it.js
#	test/javascripts/lib/pretty-text-test.js
2020-07-17 23:31:01 +02:00
Robin Ward 2a4a2a2ab7 FIX: More 404 image requests in test
A few tests were removed that were testing a subforum for the logo,
which I don't think gain us much anymore. We use `getURL` everywhere and
needn't test it so much. Plus, over time it's always good to remove
a few tests here and there :)
2020-07-17 14:58:32 -04:00
Robin Ward f68ea29236 FIX: Don't load images that don't exist in test
This makes 404 requests and fills up the logs with junk
2020-07-17 14:33:38 -04:00
Robin Ward 0ecca3a2d2 FIX: tooltip is no longer used
It has been deprecated and now it's time to remove it.
2020-07-17 14:08:45 -04:00
Robin Ward edff796e87 FIX: `Discourse.Site` is deprecated 2020-07-17 14:03:59 -04:00
Penar Musaraj 36bad0c31f
FIX: Preload metadata for audio/video when secure media enabled
Fixes an issue with missing video previews. Should have no side effects now that presigned URLs expire after 5 minutes.
2020-07-15 18:36:51 -04:00
Penar Musaraj c02e358146
FIX: Remove social sharing icons from private contexts (#10213) 2020-07-13 14:35:39 -04:00
Robin Ward 5b276af921
Remove `Discourse.SiteSettings` from tests (#10193)
* Remove unused Discourse.SiteSettings

* Remove `Discourse.SiteSettings` from many tests

* REFACTOR: `lib:formatter` was using a lot of leaky state

* Remove more `Discourse.SiteSettings` from tests

* More SiteSettings removed from tests
2020-07-09 15:54:53 -04:00
Jarek Radosz 7d289a4f3e
UX: Style video elements, show descriptions (#10040)
It's a stop gap – ideally we would generate a thumbnail for uploaded videos. For now, a bit of intentionality in the style and a pinch of context should do.
2020-06-17 12:38:00 +02:00
Jarek Radosz a859d507e7
FIX: Prevent producing "undefined" strings (#10042)
Fixes a bug in search-menu-results (type: "group"), where:

```javascript
const fullName = escapeExpression(group.fullName);
const name = escapeExpression(group.name);
const groupNames = [h("span.name", fullName || name)];
```

`groupNames` could end up having value "undefined" if a group doesn't have a `fullName`.
2020-06-17 12:37:06 +02:00
David Taylor 293467a37a
REFACTOR: Remove jquery usage from resolveAllShortUrls, and fix debounce
- This function now requires an explicit scope. It will never run on the entire document.

- Previously debounce was being used with an anonymous function, which means it was having no effect.
2020-06-05 17:15:14 +01:00
Robin Ward ba00cc8ec4
DEV: Move `Discourse.getURL` and related functions to a module (#9966)
* DEV: Move `Discourse.getURL` and related functions to a module

* DEV: Remove `Discourse.getURL` and `Discourse.getURLWithCDN`

* FIX: `get-url` is required for server side code

* DEV: Deprecate `BaseUri` too.
2020-06-03 12:45:26 -04:00
Penar Musaraj b1c726be0d
Remove support for FontAwesome 4.7 icon names (#9871) 2020-05-26 14:53:32 -04:00
Robin Ward aa2d040526 DEV: Update ESLint to remove I18n global
Also fixes missed imports in core.
2020-05-14 10:18:12 -04:00
Robin Ward f9608c0af5 DEV: Remove INLINE_ONEBOX_* constants
There were two constants here, `INLINE_ONEBOX_LOADING_CSS_CLASS` and
`INLINE_ONEBOX_CSS_CLASS` that were both longer than the strings they
were DRYing up: `inline-onebox-loading` and `inline-onebox`

I normally appreciate constants, but in this case it meant that we had
a lot of JS imports resulting in many more lines of code (and CPU cycles
spent figuring them out.)

It also meant we had an `.erb` file and had to invoke Ruby to create the
JS file, which meant the app was harder to port to Ember CLI.

I removed the constants. It's less DRY but faster and simpler, and
arguably the loss of DRYness is not significant as you can still search
for the `inline-onebox-loading` and `inline-onebox` strings easily if
you are refactoring.
2020-05-07 16:14:38 -04:00
Martin Brennan 7e303f9320
DEV: Upgrade sinon and fix time based bookmark tests (#9647)
Update sinon.js to 9.0.2 to access async fake timers https://sinonjs.org/releases/v9.0.2/fake-timers/ which can then be used with acceptance tests (previously useFakeTimers didn't work with await, e.g. for visit).

Fix the bookmark acceptance test that was time based to use these new fake timers.

Add a fakeTime function that uses moment and the provided date string + timezone to freeze time using useFakeTimers and return a clock.

Add a timeStep function that accepts a clock from fakeTime and a function to run. Once the function is run we call clock.tickAsync(1000) to progress the fake clock forward 1s to progress promises/callbacks.
2020-05-07 09:10:32 +10:00
Robin Ward 01929e3505 DEV: Move `preload-store` to `discourse/lib/preload-store`
It's only used inside Discourse so it needn't be its own module
2020-05-06 15:28:06 -04:00
tshenry b8b1cbbfb9
UX: Improve second factor UI (#9526)
This will make a few minor improvements to the second factor user interface. Highlights include:

- Using the site's title to prefix the backup code filename. If non-ascii characters are detected, then prefix "discourse" instead.
- Add icons and change the text on some of the buttons for better clarity and consistency
- Add an education link to the security key modal
2020-05-05 11:05:25 +10:00
Martin Brennan d7f744490a
FEATURE: Decorate topic-level bookmark button with reminder time (#9426)
* Show the correct bookmark with clock icon when topic-level bookmark reminder time is set and show the time of the reminder in the title on hover.
* Add a new bookmark lib and reminder time formatting function to show time with today/tomorrow shorthand for readability. E.g. tomorrow at 8:00am instead of Apr 16 2020 at 8:00am. This only applies to today + tomorrow, future dates are still treated the same.
2020-04-16 09:20:44 +10:00
Vinoth Kannan 4a2c4232c5
FIX: remove word boundary regex (\b) for search result highlights. (#9338) 2020-04-15 11:11:00 +05:30
Vinoth Kannan 0cef409d49 UX: strip base64 image URLs when converting HTML to markdown. 2020-04-12 21:05:23 +05:30
Jarek Radosz ae1a391377
FIX: Quoting posts (#9378)
Fixes to the quote feature. Most important changes listed below:

* FIX: Correctly attribute quotes when using Reply button
* FIX: Correctly attribute quotes when using replyAsNewTopic
* FIX: Allow quoting a quote
* FIX: Correctly mark quotes as "full"
* FIX: Don't try to create a quote if it's empty
* DEV: Remove an obsolete method `loadQuote`
  It isn't used in core anymore, the only use in core has been removed over 4 years ago in 3251bcb. It's not used in any plugins in all-the-plugins and all references to it on GitHub are from outdated forks (https://github.com/search?q=%22Post.loadQuote%22&type=Code)
2020-04-08 16:28:23 +02:00
Jarek Radosz 874999941a
DEV: Fix some more flaky tests (#9384)
Includes:
* DEV: Don't overwrite a computed property in test
2020-04-08 12:46:43 +02:00
Joffrey JAFFEUX 0996c3b7b3
FEATURE: allows multiple custom emoji groups (#9308)
Note: DBHelper would fail with a sql syntax error on columns like "group".

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
2020-03-30 20:16:10 +02:00
Robin Ward 60df2ade8d Retry: Rename all test files from JS -> ES6 2020-03-26 12:25:46 -04:00
Robin Ward 4fa580fbd1 Revert "Rename all test files from JS -> ES6"
This reverts commit 2abe85b834.
2020-03-25 16:13:43 -04:00
Robin Ward 2abe85b834 Rename all test files from JS -> ES6 2020-03-25 15:03:21 -04:00
David Taylor d62d258fe5
Revert "FIX: word boundary regex (\b) not working in Unicode languages. (#9163)"
Lookbehind regex is not supported in Firefox or IE11

This reverts commit 572bb5988f.
2020-03-25 14:34:45 +00:00
Vinoth Kannan 572bb5988f
FIX: word boundary regex (\b) not working in Unicode languages. (#9163) 2020-03-25 18:39:19 +05:30
Joffrey JAFFEUX d3b53fb551
REFACTOR: removes legacy bootstrap css class (#9174) 2020-03-11 15:31:29 +01:00
Joffrey JAFFEUX 683cb28099
DEV: enforces ember-template-lint: no-triple-curlies (#9165)
This pr replaces `{{{ }}}` usage by a {{html-safe}} helper. While it doesn't solve the underlying issue, it gives us a path forward without risking breaking too much existing behavior.

Also introduces an htmlSafe computed macro:

```
import { htmlSafe } from "discourse/lib/computed";

htmlDescription: htmlSafe("description")
```

Overtime {{html-safe}} usage should be removed and moved to components properties or specialized components/helpers.
2020-03-11 09:23:10 +01:00
romanrizzi f795c1b8e8 Revert "DEV: enforces ember-template-lint: no-triple-curlies (#9150)"
This reverts commit d436b600fb.

Triple curlies are still necessary for some raw templates.
2020-03-10 15:00:12 -03:00