Commit Graph

27492 Commits

Author SHA1 Message Date
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
Gerhard Schlager f3b2ee8e1b
FIX: Use default locale for footer of embedded topics (#17760)
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.
2022-08-02 20:49:28 +02:00
Meghna 5ac4e82540
UX: add ellipsis for long category names in category chooser dropdown (#17758) 2022-08-02 21:57:47 +05:30
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 381365facc
FIX: Update word_watcher cache key following schema change (#17755)
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.
2022-08-02 12:11:08 +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
Pixlz b9c1e63bd1
UX: Change unrelated icon in the CTA Signup prompt (#17732) 2022-08-02 13:27:18 +08:00
David Taylor 5d6694ac4f
DEV: Remove duplicate getter from category-section-link (#17705) 2022-08-02 13:26:36 +08:00
Alan Guo Xiang Tan f204538f7c
UX: Remove count from more section links (#17747)
Less is more...
2022-08-02 11:20:55 +08:00
Kris 8df2756bba
DEV: set CSS custom property for footer-nav-height (#17744) 2022-08-01 18:01:06 -04:00
Arpit Jalan cfd0a04965
FIX: wizard last step "corporate" was not saving changes (#17739) 2022-08-01 14:49:09 +05:30
Joffrey JAFFEUX 6ce75d3824
DEV: dom clean should be cancelled on aborted transition (#17736) 2022-08-01 10:56:41 +02:00
Alan Guo Xiang Tan de54bdd73d
DEV: Add API bridge for custom hamburger menu links to sidebar (#17742)
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.
2022-08-01 16:45:09 +08:00
David Taylor 9534f13256
DEV: Replace `site-settings:main` with `service:site-settings` (#17734)
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.
2022-08-01 09:43:33 +01:00
Alan Guo Xiang Tan ad6b5825bf
DEV: `addTopicsSectionLink` -> `addCommunitySectionLink` plugin api (#17740) 2022-08-01 15:19:52 +08:00
Krzysztof Kotlarek af912b4b0e
DEV: Experimental scroll sidebar to specific element event handler (#17727) 2022-08-01 12:39:00 +08:00
Kris 2743339a7e
UX: adjust sidebar margin to avoid composer height (#17731) 2022-08-01 11:02:11 +08:00
Pixlz e58c25939c
UX: Fix extra spacing for group metadata in user profile (#17725) 2022-07-29 13:47:14 -04:00
Meghna b5ea6e746c
UX: updated account activation page design (#17730) 2022-07-29 22:33:11 +05:30
Kris c97bfa1c44
UX: Add the TOS disclaimer to the invite signup (#17717) 2022-07-29 12:04:36 -04:00
Angus McLeod 867929d843
DEV: Add topic title suffix outlet (#17647) 2022-07-29 11:07:28 -04:00
Sam d716e32a32
FIX: bots could generate errors when slug generation method is encoded (#17224)
* 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>
2022-07-29 16:27:52 +10:00
Wolftallemo f590b62a31
FIX: Accept HEAD requests for mandrill webhook (#17180)
Madrill uses a HEAD request for validation, accept it.
2022-07-29 16:26:31 +10:00
Alan Guo Xiang Tan c9a3aba5a2
DEV: Use toggle event for sidebar more-section-links component (#17729)
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.
2022-07-29 13:09:32 +08:00
Alan Guo Xiang Tan a6e815f243
UX: Only set user bookmarks loading state when loading (#17728)
Follow-up to 6bb77d3055
2022-07-29 13:11:01 +10:00
Martin Brennan 6bb77d3055
FIX: Show bookmarks loading spinner correctly (#17726)
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.
2022-07-29 12:31:53 +10:00
Jarek Radosz 6849775a2d
Revert "DEV: Minor topic-tracking-state refactor (#17707)" (#17724)
This reverts commit 8d613e0b85.
2022-07-29 09:36:14 +10:00
David Taylor 497d9849d3
FIX: Ensure all public topic-query options can be used via Ember (#17706) 2022-07-29 09:03:53 +10:00
Jarek Radosz 8d613e0b85
DEV: Minor topic-tracking-state refactor (#17707)
* 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
2022-07-28 23:46:30 +02:00
David Taylor 9d753cb89e
FIX: Ensure theme_uploads_local only has one `/` at beginning (#17719)
Followup to c7dfb1c549
2022-07-28 22:20:52 +01:00
David Taylor c7dfb1c549
DEV: Use relative URLs for theme_uploads_local (#17715)
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.
2022-07-28 20:38:22 +01:00
Kris a737195687
UX: sidebar appearance shouldn't shrink fonts (#17714) 2022-07-28 14:18:27 -04:00
Andrei Prigorshnev 2cb97d8de4
FEATURE: show user status on the user profile page (#17712) 2022-07-28 21:12:48 +04:00
Kris 391c687afb
UX: sidebar focus styles, remove hover for touch (#17713) 2022-07-28 13:04:00 -04:00
Andrei Prigorshnev 023835cdad
DEV: a new `d-tooltip` component (#17513) 2022-07-28 18:33:20 +04:00
Kris a23e934730
FIX: show button bar overflow on iPad & mobile (#17708) 2022-07-28 09:26:06 -04:00
Alan Guo Xiang Tan 9efeaf2ae3
UX: Reduce number of links displayed in Community by default (#17703)
Additional links are hidden by default and can be accessed via the
"more..." link.
2022-07-28 16:46:46 +08:00
Osama Sayegh 988a175e94
DEV: Add reviewables tab to the new user menu (#17630)
This commit is a subset of the changes proposed in https://github.com/discourse/discourse/pull/17379.
2022-07-28 11:16:33 +03:00
Vinoth Kannan 72b24f3fb9
FIX: allow array values for custom fields in category params. (#17692)
Previously, when we used `params[:custom_fields].try(:keys)` code it worked for all the custom fields unless it's an array. It created the problem in the discourse-restricted-replies plugin.

https://github.com/discourse/discourse-restricted-replies/pull/37#issuecomment-1194207693
2022-07-28 07:53:35 +05:30
David Taylor d3751c70c9
FIX: Ensure error handlers render correctly without preload_json (#17696)
Some errors (e.g. InvalidAccess) are rendered with `include_ember: true`. Booting the ember app requires that the 'preload' data is rendered in the HTML.

If a particular route was configured to `skip_before_action :preload_json`, and then went on to raise an InvalidAccess error, then we'd attempt to render the Ember app without the preload json. This led to a blank screen and a client-side error.

This commit ensures that error pages will fallback to the no_ember view if there is no preload data. It also adds a sanity check in `discourse-bootstrap` so that it's easier for us to identify similar errors in future.
2022-07-27 22:29:13 +01:00
Jarek Radosz 7980c41832
DEV: Fix fake-timer issues (#17681)
Occasionally some code (e.g. live-reload) would try to clear a timer that was set up before fake timers were installed. That would lead to issues and warnings. Enabling `shouldClearNativeTimers` option fixes it.
2022-07-27 22:54:22 +02:00
Roman Rizzi 7c73e896ce
SECURITY: Prevent abuse of the update_activation_email route (#17694) 2022-07-27 17:04:42 -03:00
chapoi 47e664e3b1
UX: copy change (#17690) 2022-07-27 18:55:24 +02:00
David Taylor 96abd72387
DEV: Replace `message-bus:main` with `service:message-bus` (#17691)
This will allow consumers to inject it using `messageBus: service()` in preparation for the removal of implicit injections in Ember 4.0. `message-bus:main` is still available and will print a deprecation notice.

The MessageBus library is not en ember object, and doesn't need access to any of our injections. Therefore, we can set up a simple class which defines itself as a 'Service Factory', and returns the MessageBus library in the `create` method.
2022-07-27 17:15:58 +01:00
Roman Rizzi f1c3670d74
FIX: Publish membership update events when refreshing automatic groups. (#17668)
Adding or removing users from automatic groups is now consistent with `Group#add` and `Group#remove`.
2022-07-27 11:34:08 -03:00