Commit Graph

2443 Commits

Author SHA1 Message Date
Ahmed Gagan
b14098ce28
removed REGEXP_IN_MATCH regex to make it flexible to use with plugins (#10476)
* dynamic regex generation for 'STATUS' and 'IN' ddropdown
2020-09-01 14:33:05 +02:00
Joffrey JAFFEUX
f8062300da
DEV: removes jquery usage from highlight-syntax (#10564) 2020-09-01 09:50:49 +02:00
Martin Brennan
594d919d22
FIX: Focus first button in topic admin menu (#10562)
When using Shift+A to toggle the admin menu for a topic the first button was not focused, so the menu could not be navigated with tab.
2020-09-01 10:29:35 +10:00
Robin Ward
284b9e9911 FIX: Flaky JS test due to not waiting for promises 2020-08-31 11:46:28 -04:00
Kris
7bba65b6f5
UX: Restyle user menu so user links are findable (#10554) 2020-08-28 20:20:59 -04:00
Penar Musaraj
b7cfc9e861
FEATURE: User selectable color schemes (#10544) 2020-08-28 10:36:52 -04:00
Guo Xiang Tan
cff57c1883
DEV: Throw an error instead of a string. 2020-08-28 11:40:16 +08:00
Robin Ward
c172f2068d
REFACTOR: Remove $.cookie in favor of a local library based on it (#10548)
This helps us out in a few ways:

1. It lessens our reliance on jQuery
2. It's slightly less code because it omits options we don't use
3. It is one less library to import and put into ES6 modules
2020-08-27 14:07:51 -04:00
Joffrey JAFFEUX
f5eccdd0b8
FIX: ensures period-chooser is not losing query params (#10534)
eg repro before:
- visit http://pr-discourse.test/top/weekly?f=foo
- select another period in the period chooser
- f=foo was gone

After this commit it should still be present
2020-08-26 19:01:08 +02:00
Robin Ward
ff4de97dfd
REFACTOR: Move bootbox to an import instead of global variable (#10533) 2020-08-26 12:57:13 -04:00
Robin Ward
71e747b160 FIX: QUnit site has to be set before reset() 2020-08-25 09:16:32 -04:00
Robin Ward
a3fb732b23 REFACTOR: We can reuse getOwner for some container stuff 2020-08-25 09:16:32 -04:00
Robin Ward
347a4981a0 REFACTOR: Remove Discourse constant from get-owner 2020-08-25 09:16:32 -04:00
Robin Ward
02e8d84e30 REFACTOR: Remove Discourse constant from showModal 2020-08-25 09:16:32 -04:00
Robin Ward
98e5e1cd53 REFACTOR: Remove container from DiscourseURL 2020-08-25 09:16:32 -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
Gerhard Schlager
1959745c2c FIX: Current title wasn't visible when assigning badge title 2020-08-24 21:39:44 +02:00
Joffrey JAFFEUX
226be994da
REFACTOR: rewrite the emoji-picker (#10464)
The emoji-picker is a specific piece of code as it has very strong performance requirements which are almost not found anywhere else in the app, as a result it was using various hacks to make it work decently even on old browsers.

Following our drop of Internet Explorer, and various new features in Ember and recent browsers we can now take advantage of this to reduce the amount of code needed, this rewrite most importantly does the following:
- use loading="lazy" preventing the full list of emojis to be loaded on opening
- uses InterserctionObserver to find the active section
- limits the use of native event listentes only for hover/click emojis (for performance reason we track click on the whole emoji area and delegate events), everything else is using ember events
- uses popper to position the emoji picker
- no jquery code
2020-08-24 14:20:51 +02:00
Gerhard Schlager
0bd27cd10b Make prettier happy 2020-08-20 16:27:32 +02:00
Vinoth Kannan
8348a41124
FEATURE: add regular_categories field in site setting & user option. (#10477)
Like "default watching" and "default tracking" categories option now the "regular" categories support is added. It will be useful for sites that are muted by default. The user option will be displayed only if `mute_all_categories_by_default` site setting is enabled.
2020-08-20 00:35:04 +05:30
jbrw
aa1fc01307
FEATURE - Moderators can create and manage groups (#10432)
Enabling the moderators_manage_categories_and_groups site setting will allow moderator users to create/manage groups.

* show New Group form to moderators

* Allow moderators to update groups and read logs, where appropriate

* Rename site setting from create -> manage

* improved tests

* Migration should rename old log entries

* Log group changes, even if those changes mean you can no longer see the group

* Slight reshuffle

* RouteTo /g if they no longer have permissions to view group
2020-08-19 10:41:40 -04:00
Robin Ward
3640c00b03
Remove Discourse constant usage (#10470)
* REFACTOR: Get us closer to no `Discourse` constants in tests

* REFACTOR: Remove `Discourse.currentUser`

* REFACTOR: `prioritizeNameInUx` is really a helper and can use context

* REFACTOR: Rename test

* REFACTOR: Remove `Discourse.MarkdownItURL` and use session

* REFACTOR: Remove unused `LetterAvatarVersion`

* REFACTOR: Remove unused `Discourse.ThemeSettings`

* REFACTOR: Remove unused CDN constants

* REFACTOR: The `globalNotice` property doesn't exist anymore

* REFACTOR: Remove `Discourse.__container__` from plugin api

* REFACTOR: Consider `logout()` a helper and remove container.
2020-08-19 08:51:48 -04:00
Penar Musaraj
1a7391a251
FIX: do not override logo markup when loading page in dark mode
Ensures that when loading the page in dark mode, logo can switch back to light logo if user toggles their OS appearance.
2020-08-18 20:33:42 -04:00
Robin Ward
19d057d261 REFACTOR: We can hardcode #ember-testing here to avoid a global 2020-08-17 15:56:17 -04:00
Robin Ward
5b2c306bb8 REFACTOR: Remove Discourse.HighlightJSPath from globals
Instead we use the session, and pass that along where necessary.
2020-08-17 15:45:44 -04:00
Penar Musaraj
3745f2bb86
FEATURE: Dark mode alternative logos (#10441) 2020-08-17 15:43:20 -04:00
Robin Ward
41fd7a8b72 REFACTOR: Add themeSettings to the helperContext to avoid a global 2020-08-14 13:34:21 -04:00
Robin Ward
f52927cd33 REFACTOR: Migrate screenTrack to a service 2020-08-14 13:14:17 -04:00
Vinoth Kannan
476d26159a
FEATURE: add new user option skip_new_user_tips. (#10437)
And add new site setting `default_other_skip_new_user_tips` in user preferences category.
2020-08-14 19:10:56 +05:30
Robin Ward
35d9d668c3 This is an attempt to fix a qunit heisentest 2020-08-14 08:57:28 -04:00
Neil Lalonde
d65a839577
FEATURE: allow group membership to unmute categories and tags
For sites that are configured to mute some or all categories and tags
for users by default, groups can now be configured to set members'
notification level to normal from the group manage UI.
2020-08-13 17:20:53 -04: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
Kris
1972364d0f
REFACTOR: Update the notification menu to remove scrolling (#10371) 2020-08-10 16:17:15 -04:00
Régis Hanol
bc63232d2e
FIX: sync reviewable count when opening the hamburger menu (#10368)
When a tab is open but left unattended for a while, the red, green, and blue
pills tend to go out of sync.

So whevener we open the notifications menu, we sync up the notification count
(eg. blue and green pills) with the server.

However, the reviewable count (eg. the red pill) is not a notification and
is located in the hamburger menu. This commit adds a new route on the server
side to retrieve the reviewable count for the current user and a ping
(refreshReviewableCount) from the client side to sync the reviewable count
whenever they open the hamburger menu.

REFACTOR: I also refactored the hamburger-menu widget code to prevent repetitive uses
of "this.".

PERF: I improved the performance of the 'notify_reviewable' job by doing only 1 query
to the database to retrieve all the pending reviewables and then tallying based on the
various rights.
2020-08-07 18:13:02 +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
Penar Musaraj
78d443ad40
DEV: Add linebreaks around qunit "Tests timed out" message 2020-08-07 09:32:57 -04:00
Neil Lalonde
1ca81fbb95
FEATURE: set notification levels when added to a group (#10378)
* FEATURE: set notification levels when added to a group

This feature allows admins and group owners to define default
category and tag tracking levels that will be applied to user
preferences automatically at the time when users are added to the
group. Users are free to change those preferences afterwards.
When removed from a group, the user's notification preferences aren't
changed.
2020-08-06 12:27:27 -04:00
Penar Musaraj
6fdc711b4a
FEATURE: Allow users to opt out of automatic dark mode (#10377) 2020-08-06 09:45:37 -04:00
David Taylor
8c03868808
DEV: Correctly render data- attributes in widget hbs templates (#10376)
In virtualdom, element 'properties' are not completely synonymous with element 'attributes'. In particular, `data-` properties will not be rendered as attributes. To ensure all attributes are passed through, we need to include them under an `attributes` key. For more info, see https://github.com/Matt-Esch/virtual-dom/blob/master/docs/vnode.md#custom-attributes-data-
2020-08-06 14:33:09 +01:00
Robin Ward
e6c508f690 FIX: User preferences tests didn't always have pretender called 2020-08-06 08:53:13 -04:00
Robin Ward
09254410ea FIX: Only raise proper "error" messages
Also support "1" for `QUNIT_FAIL_FAST` to make it consistent with other
arguments.
2020-08-05 16:27:06 -04:00
Robin Ward
f1b6b1bd0e FIX: Pretender errors were being swallowed
Lots of test were broken and needed fixes.
2020-08-05 15:48:57 -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
0c8365a1a2 Improve output for QUnit tests in CI:
* Uses fewer lines of output
* Always outputs error at the end even if timeout
* Support for QUNIT_FAIL_FAST ENV var to quit at first failure
2020-08-05 13:43:14 -04:00
Robin Ward
18e3339580 Quit tests early, output seed to easily reproduce failure 2020-08-05 12:21:16 -04:00
jbrw
67e8bc5342
FEATURE - allow category group moderators to split/merge topics (#10351) 2020-08-05 10:33:25 -04:00
Bianca Nenciu
f4502d7739
DEV: Fix test 2020-08-05 12:11:57 +03:00
Bianca Nenciu
42f62a9e63
FIX: Shows all_results if current settings category has no results (#10358)
Searching for a specific setting only showed results from the current selected category. Before fixing fd02856, it automatically redirected the user to all_results. This was a problem because the redirect always happened and there was no way to share a link to a specific category.

The fix to this bug is to simply redirect the user to all_results if there are no results to be displayed.
2020-08-05 09:39:54 +02:00
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
Sam Saffron
eb18f91cf7
DEV: new api to iterate through tracked topics
`topicTrackingState.forEachTracked(topic,isNew,isUnread)` can be used to
iterate through tracking state efficiently.

This is handy for extension looking at subsets of tags and categories.
2020-08-04 10:40:03 +10:00
Sam Saffron
c2276f0b7e
DEV: add acceptance test for topic list
followup on dc14d156

We previously had no tests and no cleanup
2020-07-31 11:23:12 +10:00
Bianca Nenciu
fd02856f80
FIX: Keep category name in URL when filtering (#10317) 2020-07-29 14:57:05 +03:00
jbrw
74ab4f3bff
FEATURE - group modetators visual indicator (#10310) 2020-07-28 17:15:04 -04:00
Robin Ward
01a3fa1ca8 REFACTOR: Remove Discourse.__container__ from tests 2020-07-28 14:58:31 -04:00
Joffrey JAFFEUX
11faec71ae
FIX: prevents group show serializer to override basic group serializer (#10326) 2020-07-28 18:11:15 +02: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
6fb8a92ca2 FIX: Tests that used the olds paths 2020-07-24 09:45:55 -04: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
jbrw
2aec92d0b4
FEATURE - allow Group Moderators to edit category description (#10292)
Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
2020-07-23 09:50:00 -04:00
Robin Ward
c1bcb78441 REFACTOR: Allow helpers to access site settings
Since `Discourse.SiteSettings` is removed, helpers can now include and
call `helperContext().siteSettings` to get access to the settings
without using a global variable.
2020-07-22 14:14:38 -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
Krzysztof Kotlarek
e48e64456d
FIX: test for fillGapBefore (#10272)
Missing test for that PR https://github.com/discourse/discourse/pull/10264
2020-07-22 07:33:55 +10:00
Martin Brennan
41b43a2a25
FEATURE: Add "delete on owner reply" bookmark functionality (#10231)
This adds an option to "delete on owner reply" to bookmarks. If you select this option in the modal, then reply to the topic the bookmark is in, the bookmark will be deleted on reply.

This PR also changes the checkboxes for these additional bookmark options to an Integer column in the DB with a combobox to select the option you want.

The use cases are:

* Sometimes I will bookmark the topics to read it later. In this case we definitely don’t need to keep the bookmark after I replied to it.
* Sometimes I will read the topic in mobile and I will prefer to reply in PC later. Or I may have to do some research before reply. So I will bookmark it for reply later.
2020-07-21 10:00:39 +10:00
jbrw
7ab5658462
FEATURE: Allow group moderators to add/remove staff notes (#10252)
* FEATURE: Allow group moderators to add/remove staff notes
2020-07-20 15:53:47 -04:00
Robin Ward
44cfa25d7d FIX: Focus tests are unreliable in qunit
I doubt they'll regress so let's remove them for now.
2020-07-20 15:44:29 -04:00
Robin Ward
a78b256e8b FIX: Raw jQuery usage in tests 2020-07-20 15:13:49 -04:00
Robin Ward
71b0400501 FIX: deleted is a computed property of Topic 2020-07-20 14:43:37 -04:00
Robin Ward
e625aeeb0d FIX: Report was overwriting a CP 2020-07-20 14:42:16 -04:00
Robin Ward
a0c6f1b2b4 FIX: category-drop tests were broken and overwriting CPs 2020-07-20 14:39:42 -04:00
Robin Ward
ac9fa4a056 FIX: Overwritten computed properties 2020-07-20 14:14:52 -04:00
Robin Ward
537cfb7ef6 FIX: Missing favicon in test 2020-07-20 13:25:26 -04: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
Guo Xiang Tan
7dce4bfd88
DEV: Skip failing qunit test. 2020-07-20 10:15:27 +08: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
72c44b3b19 FIX: Fewer broken image paths in tests 2020-07-17 15:43:17 -04:00
Robin Ward
394b5db848 FIX: Tests involving dates were logging warnings 2020-07-17 15:20:45 -04:00
Robin Ward
8fd1ba2b0a FIX: passwordRequired is a computed property 2020-07-17 15:07:49 -04: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
Penar Musaraj
bf22f7080d
FEATURE: optional quote sharing buttons (#10254) 2020-07-17 14:44:31 -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
Robin Ward
e1bc709dc3 FIX: Fewer 404s in JS tests 2020-07-16 16:23:54 -04:00
Robin Ward
4656812e00 FIX: More errors being logged in tests 2020-07-16 16:19:20 -04:00
Robin Ward
b5735f98e9 FIX: Remove more computed properties being set
Note: This also removes a test. The test had not properly stubbed its
request and was erroring in dev mode, and the test was relying on the
erronous result.
2020-07-16 16:06:27 -04:00
Robin Ward
766cb24989 FIX: Overwriting more computed properties 2020-07-16 13:22:13 -04:00
Robin Ward
01cd371be5 FIX: Remove computed property setting from hamburger test 2020-07-16 12:17:15 -04:00
Robin Ward
d99355deca FIX: Don't use jQuery directly in a test 2020-07-16 12:00:29 -04:00
Robin Ward
46e5372c06 FIX: Setting computed properties in tests 2020-07-16 11:57:50 -04:00
Krzysztof Kotlarek
d9475b70c7
FIX: count new and unread respects muted categories (#10131)
* FIX: count new and unread respects muted categories

countCategoryByState function should take categories muted by the user into consideration
2020-07-16 12:24:51 +10: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
Robin Ward
9889b7277f FIX: Silence route-recognizer source map errors in development mode 2020-07-15 15:42:04 -04:00
Robin Ward
2e8665ba43 FIX: Can't set url on topics, it is calculated from slugs 2020-07-15 13:46:04 -04:00
Robin Ward
16766a5d62 FIX: topic.details is not a plain JS Object 2020-07-15 13:10:05 -04:00
Robin Ward
a37a19b55c REFACTOR: Remove less effective method of injecting siteSettings 2020-07-15 11:48:55 -04:00
David Taylor
7d300006a1
Revert "PERF: Move highlightjs to a background worker, and add result cache (#10191)"
This caused a CORS error when used with S3 asset storage

This reverts commit d09f283e91.
2020-07-15 13:52:35 +01:00