Commit Graph

2372 Commits

Author SHA1 Message Date
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