Commit Graph

58199 Commits

Author SHA1 Message Date
b9dd9c70a5 DEV: Migrate Sidekiq to a dedicated Redis DB
As we’re currently using a namespace for Sidekiq, in order to upgrade to
the latest version, we need to drop it as it’s not supported anymore.

The recommended way is to use a different Redis DB for Sidekiq.

This patch uses a different config for Sidekiq and also takes care of
migrating existing jobs (in queues and the retry and scheduled sets).
2025-03-03 15:42:26 +01:00
80625f6c1c DEV: explicit json for emojis/search-aliases (#31582)
Adds `.json` a suffix everywhere and makes it clear that's it's a json
route.

Also adds a missing spec for this endpoint and updates the underlying
discourse-emojis gem for better symlinking
2025-03-03 15:21:16 +01:00
1bd61630ef UX: Simplify admin theme editor (#31561)
- Hide seldom-used fields behind an 'advanced' checkbox. This replaces
the old 'only show edited' checkbox, since the number of fields shown by
default is now so small that 'only show edited' isn't useful.
Mobile/desktop targets are included in that list because we now
recommend people use CSS breakpoints for handling different device
sizes.

- Update names & descriptions of fields to be more descriptive

- Show the descriptions of fields at the top of the editor. Previously
they were only shown as tooltips.

Before:
<img width="1109" alt="SCR-20250228-lunn"
src="https://github.com/user-attachments/assets/8faebba1-39c1-491a-b236-411cfb6d9c74"
/>

After, default view:
<img width="1102" alt="SCR-20250303-kayr"
src="https://github.com/user-attachments/assets/1e483845-613f-44d6-83d6-ade628251fe5"
/>

After, advanced view:
<img width="1122" alt="SCR-20250303-kazn"
src="https://github.com/user-attachments/assets/45b8933d-2271-42ba-b5b4-81b326709adb"
/>
2025-03-03 12:20:11 +00:00
d38acc5df1 DEV: discourse-emojis gem (#31408)
This commit moves most of emoji logic into the discourse-emojis gem:
https://github.com/discourse/discourse-emojis/

Most notably:
- images are now symlinked from the gem
- the gem provides path to the json files

Search aliases have also been made asynchronous and memoized. When you
will search for an emoji we will now load the aliases and store the list
for future use.

---------

Co-authored-by: David Taylor <david@taylorhq.com>
2025-03-03 13:09:08 +01:00
6b6cffdf85 DEV: Resolve flaky user-agent spec (#31580)
Followup to 8615fc6cbbd1085b37b5ec251e4acd39b16cb839

Stubbing things which are memoized means we'd need to clear the caches
before & after the tests to be safe. Easier to just avoid the stubs
altogether.
2025-03-03 10:43:33 +00:00
a5c21a92b2 UX: Add recommended image size for category logos (#31574)
This adds a description to the category logo image fields that informs users of the recommended image aspect ratio and minimum size to upload.
2025-03-03 20:53:36 +11:00
0d90f6e3c3 FIX: cross origin opener policy should apply to public error responses (#31559)
In some error paths, headers that were set earlier can get overwritten
(e.g. `Cross-Origin-Opener-Policy`) by middleware such as
ActionDispatch::ShowExceptions.

This PR sets the `Cross-Origin-Opener-Policy` header to the value of the
SiteSetting `cross_origin_opener_policy_header` if it's missing and if
the response is for HTML.

In future, this DefaultHeaders middleware can be used to set other
default headers that relate to security or other purposes.

### Testing
<img width="631" alt="test"
src="https://github.com/user-attachments/assets/05106a40-2bc7-435d-91a2-4dd2a098f349"
/>
2025-03-03 17:04:24 +08:00
66ecfc8996 DEV: Correct users create API docs (#31578)
The API docs is incorrect as the `active` param is only permitted when
an admin API key
is used. This has always been the case since
429f27ec96c090d9054c498263f0cb635b665d99
2025-03-03 16:42:46 +08:00
5c4c8b81eb DEV: prevent sass mixed declarations warning (#31577)
Prevents deprecation warning of sass mixed declarations. We should move
declarations above nested styles.

We get the following message from logs:
```
DEPRECATION WARNING [mixed-decls]: Sass's behavior for declarations that appear after nested
rules will be changing to match the behavior specified by CSS in an upcoming
version. To keep the existing behavior, move the declaration above the nested
rule. To opt into the new behavior, wrap the declaration in `& {}`.
```

For more info see:
https://sass-lang.com/documentation/breaking-changes/mixed-decls/
2025-03-03 12:10:56 +04:00
081a0159d8 UX: search dropdown layout improvements (#31568)
This change improves the alignment and placement of the search spinner
and icons (ie. clear search / advanced search). Having a fixed width on
desktop prevents the search field from changing width when the loading
icon is toggled.
2025-03-03 09:36:53 +04:00
8615fc6cbb DEV: Add a user agent to all HTTP requests that Discourse makes. (#31555)
This change standardises the `User-Agent` header that Discourse will send when talking to other sites.

`Discourse.user_agent` is now the authority on what the user agent value should be. For Onebox requests, this changes the user agent from their existing value to match the new value (unless overridden).

For all other requests, `Net::HTTPHeader` is monkey-patched to add a default `User-Agent` header when one hasn't been provided.
2025-03-03 16:32:25 +11:00
8325d42e56 FEATURE: Experimental admin search refinements round 1 (#31441)
Followup e26a1175d7c33746bddbc858ad89e68cc14beefe

Adds extra functionality and tests for the admin search modal.

* Show third level plugin config pages in search, e.g.  AI Usage
* Remember last used search filters
* Allow navigating search results with keyboard, using tab or up/down
and enter to go to result
* Add a placeholder beneath search input to tell the admin what to do
* Add a full page search at `/admin/search` which can be reached from
pressing Enter on the search input
* Add specs for modal and full page search
* Change admin sidebar filter "no results found" to point to full page
search
* Add keyboard shortcut help to modal for admin search
2025-03-03 13:56:07 +10:00
c0bbff598a FEATURE: Allow admins to access group chats (#31440)
In #31366, we added the ability for admins to remove people from group chats. However, that only works as long as the admin is already in the group chat.

For forum-side group messages, admins can join any of them at will. This PR extends that same ability to chat for parity.
2025-03-03 09:20:13 +08:00
258dfab8d7 DEV: Replace Rinku native gem with PrettyText (#31557)
We have a native dependency, Rinku, that's used only to make links in one place. We can get rid of this and use PrettyText instead.

This is almost a one-for-one replacement, but PrettyText adds rel="noopener nofollow ugc" to external links, which I suspect is actually what we want. It also wraps the result in a <p> tag, which we strip out for parity with Rinku.
2025-03-03 09:19:17 +08:00
176ee0bf60 DEV: Add posts_controller_create_user modifier (#31562)
Add `posts_controller_create_user` modifier to modify which user is associated with the post creation.
2025-02-28 15:11:12 -06:00
c95c3c4311 DEV: correct class on trigger of notifications-tracking (#31560)
If we have a custom content for a `DMenu` trigger the `DButton` has no
way to know there's text in this custom content so it will output the
"no-text" class on the `DButton`. The correct way to fix this is to use
our own `DButton` and the `@triggerComponent` so we can fully replace
the behavior and set the correct classes.
2025-02-28 21:07:33 +01:00
dfb9418da0 DEV:add outlet wrapper for user summary topic (#31546)
- Add an outlet wrapper for user summary topic
2025-02-28 16:33:22 -03:00
cbdd28321e DEV: Add app event triggers for interface color changes (#31558) 2025-02-28 12:08:42 -04:00
56a0b17b12 Introduce a new plugin outlet (#31542)
Adds a new plugin outlet below the `flagging.review_process_description`
customizable text.

The customizable text only accepts plain-text. This plugin outlet would
allow developers to add additional description with any rich-text
content they need, such as paragraphs and links.
2025-02-28 10:52:31 -05:00
5312550bf9 A11Y: read who liked/read a post when count clicked (#31549)
This change adjusts the markup and aria tags so that the like and read
counts on posts will read who liked/read when clicked. Previously this
content was inaccessible to screen readers.


![image](https://github.com/user-attachments/assets/d205eb9a-ffa9-4955-8191-7a0411b23c46)

This change required: 

* Keeping the empty containing divs present and adding `aria-live` tags
(if the `aria-live` tag isn't initially present in the DOM, it will not
read changes to the content within)
* Adjusting some styles to avoid extra margin from the empty div (added
a conditional class to add the margin back when expanded)
* Cleaned up the aria tags, we don't need to hide the "liked this" text,
as it will be read naturally after the usernames like "username1,
username2, liked this" This allows us to remove the screenreader only
description.
* Removed "Click to view" from the button label, the interactivity is
inherent because the screenreader identifies it as a button
2025-02-28 09:15:04 -05:00
3efbd95ad8 FEATURE: add search field to header (#31447)
Adds a search field to the page header on desktop that is controlled by
a site setting (within Search).

The search field toggles back to the search icon (magnifying class) when
the header is minimized (ie. scrolling in topics) and restores to the
field again when header is no longer minimized.

On mobile the search experience is still the same.
2025-02-28 12:47:09 +04:00
a19c45fdc0 Build(deps): Bump excon from 1.2.4 to 1.2.5 (#31552)
Bumps [excon](https://github.com/excon/excon) from 1.2.4 to 1.2.5.
- [Changelog](https://github.com/excon/excon/blob/master/changelog.txt)
- [Commits](https://github.com/excon/excon/compare/v1.2.4...v1.2.5)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-28 00:07:22 +01:00
4a97e58902 Build(deps-dev): Bump rubocop from 1.73.0 to 1.73.1 (#31551)
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.73.0 to
1.73.1.
- [Release notes](https://github.com/rubocop/rubocop/releases)
-
[Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
-
[Commits](https://github.com/rubocop/rubocop/compare/v1.73.0...v1.73.1)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-28 00:07:04 +01:00
edd413a71a Build(deps-dev): Bump @swc/core from 1.11.1 to 1.11.4 (#31550)
Bumps [@swc/core](https://github.com/swc-project/swc) from 1.11.1 to
1.11.4.
- [Release notes](https://github.com/swc-project/swc/releases)
- [Changelog](https://github.com/swc-project/swc/blob/main/CHANGELOG.md)
-
[Commits](https://github.com/swc-project/swc/compare/v1.11.1...v1.11.4)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-28 00:06:42 +01:00
17b42d9786 UX: Evenly distribute nav-space for drop-downs & buttons (#31545) 2025-02-27 16:03:32 -06:00
fb98ced782 DEV: add scope param to user_confirmed_email event (#31394)
EmailToken.confirm is called in a number of contexts (hence the need for
the `scope`) and this is sometimes needed in `user_confirmed_email`
callbacks to distinguish those contexts.
2025-02-27 14:53:06 -05:00
29fd411800 A11Y: retain focus on highlighted post to avoid scroll jump (#31547)
Here we correctly focus a mid-stream post for screenreaders so they know
where to start, but once focus is removed NVDA becomes unmoored and will
jump back up the post stream to a previous post if someone tries to
navigate with the arrow keys.

Retaining the focus prevents this and shouldn't have any major
side-effects.

Tested using Chrome and NVDA
2025-02-27 14:31:55 -05:00
7fc946af4c A11Y: add aria-hidden="true" wrapper around zero width space character in buttons (#31544)
The zero width space added here as a layout fix seems to get noticed by
screenreaders (tested in NVDA) and gets "read" as text.

This means that instead of falling back to the button title, which is
the normal behavior for textless buttons, the screenreader reads the
blank space. This results in buttons like the post controls being read
simply as "button" with no other description.

Wrapping the space in `aria-hidden` corrects this, and results in the
button title being read properly.
2025-02-27 12:51:10 -05:00
fba7768cb1 DEV: Move mobile-specific admin styles to admin css bundle (#31529)
Having them under `mobile/` means they're loaded for all users. Better
to put them in the admin-only bundle, and scope with `.mobile-view`

See also: ffdc97f37296e9568d7a5dcec4d1e90e973a6893
2025-02-27 17:20:55 +00:00
dd4cee5fa5 DEV: Enable Bundler checksums
See https://bundler.io/blog/2024/12/19/bundler-v2-6.html.
2025-02-27 14:43:11 +01:00
8c9a2d21ce Revert "DEV: Prevent crawlers from loading search results. (#31535)" (#31540)
This reverts commit 38de3d7bd1f503743c5d0237bc8a8d9d89effb8e. This
changed seemed to be blocking our own AI helper as well if it has the
“Search” tool.
2025-02-27 10:34:18 +01:00
bf287b4560 FIX: Duplicate error for chat messages for upload-only messages (#31539)
This commit fixes an issue where if you tried to post
2 chat messages in quick succession which only contained
uploads (both `message` fields would be `""`), then we
would show the "You posted an identical message too recently."
error.

We should not do this for upload-only messages, they
are not identical messages.
2025-02-27 17:17:36 +10:00
e92e05b22e FIX: Error when leaving group DM channel (#31537)
Followup b5147a4634f0fd5c98262f949a8c766bfd73d290

When we aliased `leave` to `remove` and renamed
the method in `DirectMessageChannel` in the previous
commit, this inadvertantly caused an error when
unfollowing group channels in the channel list.

When clicking the X in the channel list, we hit
ChannelsCurrentUserMembershipFollowsController for the
current user and the channel, which is supposed to only
unfollow the channel for all channel types including DMs.

Group DMs have a different Leave behaviour vs Unfollow.
Leaving the channel altogether is done from the channel
settings page, the "Leave channel" button, and that
deletes the user's membership and DM user record from that
channel.

So, we were trying to do the leave channel behaviour in the
unfollow channel controller, which was returning the wrong
record for the serializer (a User not a Membership)

This fixes the issue and removes a bit of delegate/alias indirection
which was making the code a bit harder to fllow and search, even
though it was more succinct. Also adds missing specs that would
have caught this regression.
2025-02-27 14:26:07 +10:00
39f4485939 FIX: Don't attach images that aren't rendered in the digest e-mail (#31525)
When secure uploads are enabled, we need to send images that are rendered in the digest e-mail as attachments. Before this change, we would indiscriminately attach all images in the relevant topic's first post, whether they were rendered the e-mail body or not.

This change fixes that by only attaching images that are referenced in the e-mail body.
2025-02-27 11:41:17 +08:00
38de3d7bd1 DEV: Prevent crawlers from loading search results. (#31535)
This change detects if a crawler is trying to load a search results page, and returns a simple response that should indicate to them that there's no content of interest available there.
2025-02-27 14:34:19 +11:00
e5684def38 FIX: Revert "DEV: delete PasswordValidation mixin (#31520)" (#31536)
This reverts commit fbe5a9c71096dde8d7d59a0b2bec932b22c38a05.

I missed one area outside of core where this mixin is being used.
2025-02-27 10:17:37 +08:00
30c559f670 Build(deps): Bump cgi from 0.4.1 to 0.4.2 (#31534)
Bumps [cgi](https://github.com/ruby/cgi) from 0.4.1 to 0.4.2.
- [Release notes](https://github.com/ruby/cgi/releases)
- [Commits](https://github.com/ruby/cgi/compare/v0.4.1...v0.4.2)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-27 01:12:04 +01:00
fb7ada2f67 Build(deps): Bump uri from 1.0.2 to 1.0.3 (#31531)
Bumps [uri](https://github.com/ruby/uri) from 1.0.2 to 1.0.3.
- [Release notes](https://github.com/ruby/uri/releases)
- [Commits](https://github.com/ruby/uri/compare/v1.0.2...v1.0.3)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-27 01:11:37 +01:00
9d895e5bad Build(deps-dev): Bump lefthook from 1.11.1 to 1.11.2 (#31532)
Bumps [lefthook](https://github.com/evilmartians/lefthook) from 1.11.1
to 1.11.2.
- [Release notes](https://github.com/evilmartians/lefthook/releases)
-
[Changelog](https://github.com/evilmartians/lefthook/blob/master/CHANGELOG.md)
-
[Commits](https://github.com/evilmartians/lefthook/compare/v1.11.1...v1.11.2)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-27 01:11:03 +01:00
8abe5c6eac Build(deps-dev): Bump rubocop from 1.72.2 to 1.73.0 (#31533)
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.72.2 to
1.73.0.
- [Release notes](https://github.com/rubocop/rubocop/releases)
-
[Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
-
[Commits](https://github.com/rubocop/rubocop/compare/v1.72.2...v1.73.0)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-27 01:10:49 +01:00
0af0087c77 DEV: Adds empty device screenshot workflow file (#31521)
This is for continued experimentation in
https://github.com/discourse/discourse/pull/31410,
GitHub does not react to the issue_comment event unless the workflow
file is in main already,
see
https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#issue_comment

This workflow is a noop, it will be actually written/tested
in the linked PR
2025-02-27 10:07:29 +10:00
71c6f70e9e Update INSTALL.md (#31097)
Added blurb and link to official hosting at the top
2025-02-27 00:21:38 +01:00
a9928e8a71 Update LICENSE (#31217)
Updated the copyright in the LICENSE file to match with https://github.com/discourse/discourse-plugin-skeleton/blob/main/LICENSE

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2025-02-27 00:16:59 +01:00
c72922cfc7 DEV: Add emoji-picker-filter-container plugin outlet (#30976)
With the emoji picker unified
(https://github.com/discourse/discourse/pull/28277), there is no longer
a footer, including the previous plugin outlet.

This PR moves the plugin outlet at the top.

Usage example: [Emoji Fluff
TC](https://meta.discourse.org/t/emoji-fluff/339163)

Before: 

![image](https://github.com/user-attachments/assets/6274dfa6-386e-4387-9377-8ab13256528c)
After: 

![image](https://github.com/user-attachments/assets/f4f02ec1-797e-4066-837d-b436c7ad3061)
2025-02-26 23:58:50 +01:00
d0c61f790a Switch [details] to <details> to show the dropdown in ADMIN-QUICK-START-GUIDE.md (#29702)
Previously, this guide was using [details][/details] for dropdowns, but
the dropdowns did not show. I have switched it to <details></details> so
that the dropdown is showing in `ADMIN-QUICK-START-GUIDE.md`.
No tests required since this is not a code fix.

Before:
<img width="651" alt="image"
src="https://github.com/user-attachments/assets/5b4f43e8-54f2-4145-87f5-70897393e686">
<br>
<img width="699" alt="image"
src="https://github.com/user-attachments/assets/88f74299-62bf-4499-a270-5f796118e9e3">

After:
<img width="664" alt="image"
src="https://github.com/user-attachments/assets/5eb5a58a-2c80-4556-a676-e80972a73b0e">
<br>
<img width="696" alt="image"
src="https://github.com/user-attachments/assets/0cbabfd6-fe4d-46c5-a881-921dec1ad22a">
2025-02-26 16:07:04 -05:00
a65133af07 DEV: Correct truth-helper exports (#31528)
In modern embroider, `app-js` files need to be exported by the module.

We need to keep the separate `app/` directory because this v2 addon
doesn't have a build step, and therefore the relative imports in the
`src/helpers` files would break if loaded as-is into the app bundle.
2025-02-26 17:50:29 +00:00
55d0951ccc DEV: Hide non-en locale files in IDE search (#31527)
These files are managed automatically via crowdin, so they should never
be edited locally. Adding them to `.ignore` will stop them polluting
search results in IDEs which support `.ignore` (e.g. VSCode)
2025-02-26 17:24:03 +00:00
0cab9603ca DEV: Add missing broccoli-filter dependency of discourse-hbr (#31526) 2025-02-26 16:25:19 +00:00
ffdc97f372 DEV: Move desktop-specific admin styles to admin css bundle (#31524)
Having them under `desktop/` means they're loaded for all users. Better
to put them in the admin-only bundle, and scope with `.desktop-view`
2025-02-26 13:39:52 +00:00
3d515b9dd8 DEV: calendar control for form-kit (#31506)
This commit introduces a new `Calendar` control for form-kit. This
control will render a date picker and a time input. On mobile the date
picker will be replaced by a native input of type date.

The following validation options have also been added:
- `dateAfterOrEqual`
- `dateBeforeOrEqual`

The control has two options:

- `includeTime` - show or hide the time input (default true)
- `expandedDatePickerOnDesktop` - show an expanded datepicker on
desktop, or not (default true)
2025-02-26 11:23:07 +01:00