Commit Graph

15556 Commits

Author SHA1 Message Date
Osama Sayegh 590a13377b
DEV: Fix the build (#17853)
473695ee4d and 23520b88c2 were merged very close to each other, but they had some subtle conflicting changes that broke some tests.
2022-08-10 10:10:34 +03:00
Osama Sayegh 473695ee4d
DEV: Add messages tab to the new user menu (#17850)
Some of the changes in this PR are extracted from https://github.com/discourse/discourse/pull/17379.

Similar to the bookmarks tab in the new user menu, the messages tab also displays a mix of notifications and messages. When there are unread message notifications, the tab displays all of these notifications at the top and fills the remaining space in the menu with a list of the user's messages. The bubble/badge count on the messages tab indicates how many unread message notifications there are.
2022-08-10 08:25:39 +03:00
Alan Guo Xiang Tan 23520b88c2
DEV: Add `registerUserMenuTab` plugin API (#17851)
Co-authored-by: OsamaSayegh <asooomaasoooma90@gmail.com>
2022-08-10 13:21:37 +08:00
Kris 424e968538
UX: add left sidebar toggle when sidebar enabled (#17831) 2022-08-10 10:12:35 +08:00
Arpit Jalan 10a1b6b0a9
FEATURE: update bootstrap mode notice to add invite and wizard links (#17822)
* FEATURE: update bootstrap mode notice to add invite and wizard links

* Updates per feedback on PR

* Fix the wizard link not showing

* Remove unneeded function

* Remove router service injection
2022-08-10 00:13:42 +05:30
Arpit Jalan d57bea4de3
FEATURE: add welcome topic cta banner (#17821) 2022-08-09 21:52:39 +05:30
David Taylor 7f9c2c0bfb
DEV: Remove vendored babel and update config for plugins/themes (#17832)
The new plugin list is based on the ones currently used in our ember-cli pipeline, and are based on our official browser support policy.

This commit includes an update to the raw-handlebars compiler to remove the 'very hacky but lets us use ES6' code. It's  served us well for the last 6 years, but the babel config changes broke it (`const` -> `let`). This commit takes the opportunity to refactor it to take a similar approach to PrettyText, by leaning on `mini-loader.js`.
2022-08-09 11:53:24 +01:00
Jarek Radosz 9645cbea26
DEV: Clear extra header buttons (#17829) 2022-08-08 19:57:56 +02:00
Sérgio Saquetim e0f469eab8
FEATURE: Add above-modal-header plugin outlet (#17812) 2022-08-08 14:40:35 -03:00
Jarek Radosz f7e7f9a6a7
DEV: Fix a function name typo (#17828)
Co-authored-by: Osama Sayegh <asooomaasoooma90@gmail.com>
2022-08-08 18:50:39 +02:00
Jarek Radosz 8b8cbe7905
DEV: Set owner of sidebar section objects (#17827)
Allows e.g. `@service` usage in their implementation
2022-08-08 16:35:14 +02:00
Osama Sayegh 4fdb275683
DEV: Add bookmarks tab to the new user menu (#17814)
Some of the changes in this commit are extracted from https://github.com/discourse/discourse/pull/17379.

The bookmarks tab in the new user menu is different from the other tabs in that it can display a mixture of notifications and bookmarks. When there are unread bookmark reminder notifications, the tab displays all of these notifications at the top and fills the remaining space in the menu with the rest of the bookmarks. The bubble/badge count on the bookmarks tab indicates how many unread bookmark reminder notifications there are.

On the technical aspect, since this commit introduces a new `bookmark-item` component, we've done some refactoring so that all 3 "item" components (`notification-item`, `reviewable-item` and the new `bookmark-item`) inherit from a base component and get identical HTML structure so they all look consistent.

Internal tickets: t70584 and t65045.
2022-08-08 17:24:04 +03:00
Andrei Prigorshnev 94ac8611f4
FEATURE: show status on post streams (#17813) 2022-08-08 17:35:26 +04:00
Jarek Radosz e6fa05f8c3
DEV: Asyncify `findTopicList()` (#17816) 2022-08-08 11:46:09 +02:00
Joffrey JAFFEUX 2003c2d4cd
FIX: prevents android keyboard to be hidden instantly on sk focus (#17810) 2022-08-05 13:09:38 -04:00
Andrei Prigorshnev 8f66d57b86
UX: Improve empty state copy on the activity/topics page (#17746) 2022-08-05 18:37:06 +04:00
Andrei Prigorshnev 4283cef2ed
DEV: add status to the user info component (#17809)
We use the user-info component in several places, and we want to show status on some of them. If you want status to appear, do this:

{{user-info showStatus=true}}
2022-08-05 16:54:54 +04:00
Andrei Prigorshnev 9f5ba2db90
DEV: Make it possible to hide tooltip on the user status (#17808)
Sometimes status appears on popovers, and we may not want to show a tooltip in that case. But by default, tooltip is enabled.
2022-08-05 16:53:28 +04:00
Loïc Guitaut 5c37a5d0f2
FIX: Allow to add the same watched word with a different case (#17799)
Currently we can’t add a case-sensitive watched word if another one
exists with a different case. For example, the existing watched word
`Meta` has been created and is case-sensitive. Now an admin tries to add
`metA` while marking it as case-sensitive too, this won’t work and the
word won’t be added.

This patch changes this behavior by allowing to add same words that have
different cases, so the example above will now work as expected.

We still check for uniqueness but case-sensitivy is now taken
into account. It means that if the watched word `meta` already exists
and is not case-sensitive then it will not be possible to add `Meta`
(case-sensitive or not) as `meta` already matches every possible
variations of this word.
2022-08-05 12:18:17 +02:00
Osama Sayegh 0df1c4eab2
DEV: Refactor notification/reviewable items rendering in the new user menu (#17792)
Prior to this commit, we had a default Glimmer component that was responsible for handling generic rendering of notifications in the user menu, and many notification types had a custom Glimmer component that inherited from the default component to customize how they were rendered. That implementation was less than ideal because it meant plugins would have to create Glimmer components to customize notification types added by them and that would make the surface area of the API too big.

This commit changes the implementation so there's only one Glimmer component for rendering notifications, and then notification types that need to be customized can create a regular JavaScript class - `renderDirector` in the code - that provides the Glimmer component with the content it should display. We also introduce an API for plugins to register a renderer for a notification type or override an existing one.

Some of the changes are partially extracted from https://github.com/discourse/discourse/pull/17379.
2022-08-05 07:55:00 +03:00
David Taylor c1cdb6bc51
DEV: Replace `topic-tracking-state:main` with `service:topic-tracking-state` (#17802)
This will allow consumers to inject it using `topicTrackingState: service()` in preparation for the removal of implicit injections in Ember 4.0. `topic-tracking-state:main` is still available and will print a deprecation notice.

Ideally we would convert topic-tracking-state into a true service, rather than registering a model instance into the registry. However, inter-dependencies between service injections make this very difficult to achieve. We don't want to block Glimmer Component work, so this commit does the minimum for now.
2022-08-05 08:48:55 +08:00
Peter Wagenet d0cbc61619
DEV: Add jsconfig (#17800)
This enables intelligent IDE features like "Go To Reference" to function correctly within the Discourse core codebase
2022-08-04 22:50:47 +01:00
Ghassan Maslamani 2d6bd30dd8
FEATURE: add image delete button in preview. (#17624)
This commit adds a delete button to the composer preview next to the image scale buttons.

Reference: https://meta.discourse.org/t/image-remover-button-to-composer-preview/233005
2022-08-04 16:33:23 -04:00
Alan Guo Xiang Tan ad18f7488c
FIX: Secondary more section links not marked as active (#17797)
When the route of the link is equal to the active route, we promote it
out of the "more..." links drawer and display it directly under the
community section. This commit fixes a bug where the secondary links in
the "more..." links drawer was not being marked as active.

Follow-up to e09fd7cde2
2022-08-04 18:51:32 +08:00
Alan Guo Xiang Tan 02987e05d5
DEV: Support old hamburger menu custom footer links in Sidebar (#17796)
This commit extends the existing API bridge for supporting custom
general links in the old hamburger menu in Sidebar to support custom
footer links. Custom footer links can be added to the old hamburger
menu via the `api.decorateWidget("hamburger-menu:footerLinks")` API.
Footer links are added into the secondary section of the "More..." links
drawer in the Community section of the sidebar.
2022-08-04 15:05:14 +08:00
Alan Guo Xiang Tan a36584b8c8
Add support for toggling between mobile and desktop view on sidebar (#17794)
In the current hamburger menu dropdown, we have a link which allows users to toggle between mobile and desktop view on mobile and touch devices. This commit brings the same behaviour to sidebar.
2022-08-04 14:26:35 +08:00
Alan Guo Xiang Tan e09fd7cde2
UX: Move About and FAQ links into secondary section in More... dropdown (#17793)
This commit does not change any behaviour of the links and is simply
changing the positions of the links being displayed.
2022-08-04 13:41:08 +08:00
Jean 8ab6b17c36
FIX: show update banner only once on categories with subcategory lists (#17782)
* FIX: show update banner only once on categories with subcategory lists
2022-08-03 15:27:03 -04:00
Osama Sayegh 3d7829c01f
FIX: Unsubscribe from the `/reviewable_counts` channel when leaving the review-index route (#17778)
Follow-up to ce9eec8606.

When the review-index route is entered, we listen to the `/reviewable_counts` (or `/reviewable_counts/<user_id>` when the new user menu is enabled) channel so we can listen for changes to reviewables and update the UI accordingly. However, we currently don't unsubscribe when leaving the route which means each time the route is entered, we setup a new listener causing the browser to do unnecessary work and potentially state leakage.
2022-08-03 17:16:02 +03:00
David Taylor 0e6f9ef406
DEV: Replace `site:main` with `service:site` (#17766)
This will allow consumers to inject it using `site: service()` in preparation for the removal of implicit injections in Ember 4.0. `site:main` is still available and will print a deprecation notice.
2022-08-03 14:38:35 +01:00
Osama Sayegh 062a5f316d
DEV: Wire up the dimiss button in the new notifications menu (#17745)
This commit is a subset of the changes proposed in https://github.com/discourse/discourse/pull/17379.
2022-08-03 15:32:35 +03:00
Peter Wagenet 40cb46631f
DEV: Update `/admin/badges` to modern Ember patterns (#17672)
* Nest admin badges controller and route files

* Use standard file names for admin-badges

* Update resolver to allow standardized file structure for admin

* Add adminBadges.index controller for property tracking

* Modernize admin badges controller

* Modernize admin-badges route

* Add admin-badges index route

* Modernize admin-badges.show controller and route

* Modernize admin-badges.award controller and route

* Convert BadgeButton to a Glimmer component
2022-08-03 10:12:17 +01:00
David Taylor 36446649ff
DEV: Clear custom sidebar sections after each test (#17775)
Initializers are re-run before each test, so we need to clear out the list to avoid duplicates building up over multiple tests.
2022-08-03 09:42:29 +01:00
Alan Guo Xiang Tan d1d760ae7b
UX: Move links in Sidebar footer under community section (#17774)
Now that we have a "more..." links drawer, we can move some of the links
in footer into the links drawer. The footer itself does not have much
horizontal or vertical space for us to work with and hence limits the
amount of links which we can add to it.
2022-08-03 14:47:03 +08:00
Osama Sayegh 53dd9b0c66
DEV: Add `aria-label` option to the `d-icon` helper (#17741)
Extracted from https://github.com/discourse/discourse/pull/17379.
2022-08-03 09:33:50 +03:00
Osama Sayegh ce9eec8606
DEV: Combine all header notification bubbles into one in the new user menu (#17718)
Extracted from https://github.com/discourse/discourse/pull/17379.
2022-08-03 08:57:59 +03:00
Alan Guo Xiang Tan bd92df6bbe
FIX: Links incorrectly marked as active in Sidebar::MoreSectionLinks (#17771)
Before this commit, links with routes that require multiple models were
incorrectly displayed as the active link in the
Sidebar::MoreSectionLinks component because we were only checking if the
routeName was active.
2022-08-03 12:39:21 +08:00
Jeff Wong d4dda2c93a REFACTOR: Update fastly URLs in tests to generic example URLs 2022-08-02 14:32:08 -10:00
Jeff Wong 8d525b4188 REFACTOR: update search fixture urls 2022-08-02 14:32:08 -10:00
David Taylor be55367d6f
DEV: Replace `session:main` with `service:session` (#17765)
This will allow consumers to inject it using `session: service()` in preparation for the removal of implicit injections in Ember 4.0. `session:main` is still available and will print a deprecation notice.
2022-08-02 23:55:20 +01:00
David Taylor 89518f3155
DEV: Modernize store and messageBus injections in Glimmer base class (#17763)
These were overlooked when `store` and `messageBus` were converted to true services
2022-08-02 23:22:52 +01:00
Martin Brennan d2ddb140dd
FEATURE: Show SMTP response on admin email sent list and rearrange columns (#17143)
Follow up to 4d3c1ceb44, this commit
shows the SMTP response in the admin email sent list and also moves the
topic/post link into a new column. Reply key is now in its own column.
2022-08-03 08:11:54 +10:00
Sérgio Saquetim b16028bc79
FIX: Inject appEvents in ScreenTrack (#17751)
This commit reverts partially https://github.com/discourse/discourse/pull/17543.

Service appEvents was not being injected in ScreenTrack. This causes
`this.appEvents.trigger("topic:timings-sent", data);` to fail and the error is
swallowed by the `catch` on the promise.

This caused a regression on plugins that rely on this event to implement other
behaviors.
2022-08-02 16:22:17 -03:00
David Taylor 4c2f08b6e2 DEV: Replace `current-user:main` with `service:current-user`
This will allow consumers to inject it using `currentUser: service()` in preparation for the removal of implicit injections in Ember 4.0. `current-user:main` is still available and will print a deprecation notice.
2022-08-02 20:16:11 +01:00
David Taylor 2463a8d568 DEV: Improve `injectServiceIntoService` function
Previously we were preventing circular dependencies by looking up the service before adding it as an injection for future-initialized services. This works, but it means that the order of service injection is important, and we cannot have two services auto-injected into each other.

This commit takes a different approach. It removes the `lookup`, and instead adds a dummy injection which prevents the service being injected into itself during initialization. This allows us to have circular auto-imports, without breaking the injection resolver by injecting a service into itself.
2022-08-02 20:16:11 +01:00
David Taylor 58defe7169
DEV: Move all resolver deprecations into `resolver.js` (#17757)
Having them all in one place is much easier to reason with. It also means we can handle them without needing 'fake' registrations (which can sometimes cause odd behavior). This commit just moves the deprecation logic - it does not introduce any new deprecations.
2022-08-02 17:05:02 +01:00
David Taylor 4bf9b73296
DEV: Ensure `censorFn` copes with null `regexpList` (#17754)
This fixes the test suite failures introduced by 862007fb18
2022-08-02 11:09:51 +01:00
Arpit Jalan d3e8442937
DEV: add test for wizard last step and some minor optimizations (#17752) 2022-08-02 14:13:25 +05:30
Selase Krakani 862007fb18
FEATURE: Add support for case-sensitive Watched Words (#17445)
* FEATURE: Add case-sensitivity flag to watched_words

Currently, all watched words are matched case-insensitively. This flag
allows a watched word to be flagged for case-sensitive matching.
To allow allow for backwards compatibility the flag is set to false by
default.

* FEATURE: Support case-sensitive creation of Watched Words via API

Extend admin creation and upload of Watched Words to support case
sensitive flag. This lays the ground work for supporting
case-insensitive matching of Watched Words.

Support for an extra column has also been introduced for the Watched
Words upload CSV file. The new column structure is as follows:

 word,replacement,case_sentive

* FEATURE: Enable case-sensitive matching of Watched Words

WordWatcher's word_matcher_regexp now returns a list of regular
expressions instead of one case-insensitive regular expression.

With the ability to flag a Watched Word as case-sensitive, an action
can have words of both sensitivities.This makes the use of the global
Regexp::IGNORECASE flag added to all words problematic.

To get around platform limitations around the use of subexpression level
switches/flags, a list of regular expressions is returned instead, one for each
case sensitivity.

Word matching has also been updated to use this list of regular expressions
instead of one.

* FEATURE: Use case-sensitive regular expressions for Watched Words

Update Watched Words regular expressions matching and processing to handle
the extra metadata which comes along with the introduction of
case-sensitive Watched Words.

This allows case-sensitive Watched Words to matched as such.

* DEV: Simplify type casting of case-sensitive flag from uploads

Use builtin semantics instead of a custom method for converting
string case flags in uploaded Watched Words to boolean.

* UX: Add case-sensitivity details to Admin Watched Words UI

Update Watched Word form to include a toggle for case-sensitivity.
This also adds support for, case-sensitive testing and matching of  Watched Word
in the admin UI.

* DEV: Code improvements from review feedback

 - Extract watched word regex creation out to a utility function
 - Make JS array presence check more explicit and readable

* DEV: Extract Watched Word regex creation to utility function

Clean-up work from review feedback. Reduce code duplication.

* DEV: Rename word_matcher_regexp to word_matcher_regexp_list

Since a list is returned now instead of a single regular expression,
change `word_matcher_regexp` to `word_matcher_regexp_list` to better communicate
this change.

* DEV:  Incorporate WordWatcher updates from upstream

Resolve conflicts and ensure apply_to_text does not remove non-word characters in matches
that aren't at the beginning of the line.
2022-08-02 10:06:03 +02:00
Alan Guo Xiang Tan df264e49a9
DEV: Supports href attribute for hamburger links API bridge to sidebar (#17750)
In the old `decorateWidget("hamburger-menu:generalLinks", callbackFn)`
API, the return value of the callback function can either return a
`route` or `href`. The API bridge added in
de54bdd73d supported `route` but not `href` and
hence the need for this commit.
2022-08-02 15:30:13 +08:00