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.
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.
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.
The content from the remote site and the footer get cached for 10 minutes, so Discourse should use the default locale instead of the user locale for the footer. Otherwise Discourse might cache the message in a different language.
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.
862007fb18 introduced a change to the format that watched words are cached in Redis. Newly-deployed versions of the app were attempting to load the old-format data from Redis, leading to a server error. This commit introduces a CACHE_VERSION constant which we can easily bump when making changes to the cache schema.
* 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.
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.
The old hamburger menu widget was customizable via the
`api.decorateWidget("hamburger-menu:generalLinks")` plugin API. As the
hamburger menu is going to be replaced by the sidebar dropdown, we need
a way to smoothly transit plugins and theme components to the new
sidebar. This commit makes a best effort attempt to bridge
`api.decorateWidget` with `api.addCommunitySectionLink`. If an error is
encountered, a deprecation notice is logged.
This will allow consumers to inject it using `siteSettings: service()` in preparation for the removal of implicit injections in Ember 4.0. `site-settings:main` is still available and will print a deprecation notice.
* FIX: bots could generate errors when slug generation method is encoded
When slug generation method is encoded (non default) then bots could
cause errors in the logs for urls containing special chars.
ó for example in a URL can be requested in a valid ASCII-8BIT string, and
later when joined to UTF-8 would result in encoding issues.
Fix here ensures we force encoding correctly for outlier cases.
Browser tend to always encode these chars, hence we did not notice this.
Co-authored-by: Jarek Radosz <jradosz@gmail.com>
A click event is trigger on a link click as well which is not what we
want. This caused the links to trigger a full reload instead of an Ember
transition for some reason.
There was a minor issue where the bookmark loading
spinner would not show correctly because of how
the route was handling the setting of loading,
this fixes the issue.
* Use `Set` instead of `Array` for `this.newIncoming`
* Remove `isUnseen()`
* Use array spread instead of `Array.from()`
* Don't use `@on()`
* Fix typos
* Make sure `this.incomingCount` is always a Number
Relative URLs will work just fine for Web Workers, which were the original reason for introducing the `theme_uploads_local` feature
Making them relative will mean that `loadScript()` automatically uses the CDN (when enabled), which is doubly important because our CSP doesn't allow loading theme-javascripts from the host domain when the CDN is enabled.