Commit Graph

59440 Commits

Author SHA1 Message Date
0d461c4c9d DEV: Add unit tests for SiteSettingMatcher (#32500)
These should have been part of #32461, but the file wasn't staged. 🙏
2025-04-29 12:53:24 +08:00
b990df6570 FIX: Staff action log logs in default locale when a user deletes themselves (#32503)
There is a bug now where the staff action log that shows up in the
user's locale when a user deletes themselves.

<img width="962" alt="Screenshot 2025-04-29 at 12 08 49 PM"
src="https://github.com/user-attachments/assets/c367831d-25e6-453a-bce8-312ef7451a5c"
/>

This commit fixes that issue by scoping it to the site's default locale.
2025-04-29 12:32:29 +08:00
cde16697cd Bump version to v3.5.0.beta4-dev 2025-04-29 12:26:54 +08:00
bb5d5b9f83 Bump version to v3.5.0.beta3 v3.5.0.beta3 2025-04-29 12:26:54 +08:00
21a7f31622 SECURITY: Enforce DM limits properly
When adding people to a DM, the ones already in the channel weren’t
taken into account when checking whether the maximum limit was reached.
2025-04-29 12:06:33 +08:00
63037fb7ad FIX: allow tags to be restricted to admin only (#32493)
Allow creating a tag group with tags that are visible to everyone but
can be used by admin only.
2025-04-29 09:09:57 +05:30
1ab57f6910 Build(deps): Bump rqrcode from 3.0.0 to 3.1.0 (#32498)
Bumps [rqrcode](https://github.com/whomwah/rqrcode) from 3.0.0 to 3.1.0.
- [Release notes](https://github.com/whomwah/rqrcode/releases)
- [Changelog](https://github.com/whomwah/rqrcode/blob/main/CHANGELOG.md)
- [Commits](https://github.com/whomwah/rqrcode/compare/v3.0.0...v3.1.0)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-29 02:01:37 +02:00
677b54e5f0 Build(deps-dev): Bump rubocop from 1.75.3 to 1.75.4 (#32499)
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.75.3 to
1.75.4.
- [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.75.3...v1.75.4)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-29 02:01:27 +02:00
2cbb31338d Build(deps): Bump connection_pool from 2.5.2 to 2.5.3 (#32497)
Bumps [connection_pool](https://github.com/mperham/connection_pool) from
2.5.2 to 2.5.3.
-
[Changelog](https://github.com/mperham/connection_pool/blob/main/Changes.md)
-
[Commits](https://github.com/mperham/connection_pool/compare/v2.5.2...v2.5.3)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-29 01:48:28 +02:00
2682717e49 Build(deps-dev): Bump rouge from 4.5.1 to 4.5.2 (#32496)
Bumps [rouge](https://github.com/rouge-ruby/rouge) from 4.5.1 to 4.5.2.
- [Release notes](https://github.com/rouge-ruby/rouge/releases)
-
[Changelog](https://github.com/rouge-ruby/rouge/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rouge-ruby/rouge/compare/v4.5.1...v4.5.2)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-29 01:37:53 +02:00
f81b2b4e7c Build(deps-dev): Bump lefthook from 1.11.11 to 1.11.12 (#32495)
Bumps [lefthook](https://github.com/evilmartians/lefthook) from 1.11.11
to 1.11.12.
- [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.11...v1.11.12)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-29 01:23:50 +02:00
0ea6ecd84a DEV: correctly use emoji urlFor to render emojis (#32494)
This will allow the CDN to be used for custom emojis.
2025-04-28 19:46:12 +02:00
54ac9bd7b8 Revert "DEV: Remove the word tags from adobe_analytics_tags_url" (#32490)
Need the script to migrate existing settings to come together with this.
🙏
2025-04-28 22:46:28 +08:00
ed608e3ac5 A11Y: use singular tag in accessible category_tag string (#32492)
We don't do tag intersections when filtered to a category, so these can
always be singular

follow-up to
ca658a8bb0
2025-04-28 10:37:55 -04:00
c89245beff FIX: Production asset compilation following c62a4a47 (#32491)
The bypass_sprockets_uglify was removed in that commit
2025-04-28 15:04:56 +01:00
a91f8cee0a DEV: update styling class reference to d-icon-magnifying-glass (#32489)
The css class selector `d-icon-search` refers to a deprecated icon name,
this PR updates it to the correct name.
2025-04-28 21:14:13 +08:00
303b4bfbae Update translations (#32216) 2025-04-28 13:41:04 +02:00
931fa723eb DEV: Replace break_string.js with CSS in embedded view (#32488)
This JS was used to wrap long usernames. Nowadays in core, we use a
simpler `word-break: break-all;` pattern, so it makes sense to use the
same simplification in the embedded comments view.
2025-04-28 10:47:27 +01:00
c62a4a4759 PERF: Compile main locale bundles just-in-time (#32335)
Previously all locale bundles would be built & compressed during
assets:precompile. For most sites, only one of these languages was
actually used, so this is fairly wasteful.

This commit moves the main locale bundle into the
ExtraLocalesController, which has recently undergone many improvements
to make it more efficient. This allows locale files to be bundled "just
in time" when they're first accessed.

Now that brotli level=6 is enabled for these assets in our nginx config,
this change should have no impact on the locale bundle size.
2025-04-28 10:31:27 +01:00
3b9d9f5893 DEV: Remove the word tags from adobe_analytics_tags_url (#32484)
The word tags is just filler here, and conflates the search results when searching for tag-related site settings.
2025-04-28 17:08:41 +08:00
b056f9538b DEV: Improve site setting search ranking (#32461)
This change does a couple of things.

Change in behaviour:

- Matches on the site setting name and keywords now get a higher ranking in search results.
- When counting gaps for ranking fuzzy matches, we no consider the smallest number of gaps.

Code organization:

- Extract a separate SiteSettingMatcher object for the matching logic.
- Flatten some conditionals to make control flow clearer.
- Higher weight now means higher in search results.
2025-04-28 16:58:27 +08:00
77bc84a3c7 UX: Fix formatting of two shortcuts (#32479) 2025-04-28 10:25:21 +02:00
e3b35ff2a5 FIX: remove sidebar filter (#32485)
Remove sidebar filter in favour of search.

In addition:
- Search was moved up just below Dashboard;
- Do not perform search when filter is empty;
- Display "no results".

![Screenshot 2025-04-28 at 12 37
38 pm](https://github.com/user-attachments/assets/d8cabbca-2a26-413b-abfc-5ae143ff8da6)
![Screenshot 2025-04-28 at 12 37
59 pm](https://github.com/user-attachments/assets/fbae4b8d-60a2-414e-bf40-86e8c50538e6)
![Screenshot 2025-04-28 at 12 38
12 pm](https://github.com/user-attachments/assets/e04371cd-392e-48eb-91c9-21a3d8fc44c0)
2025-04-28 15:57:29 +08:00
84c8f51c54 DEV: Account for relative url root in Stylesheet::Manager cache keys (#32487)
This is mainly used for the test environment where
`Discourse.current_hostname` and `GlobalSetting.relative_url_root` can
be stubbed.

### Reviewer notes

We don't really need a test here since this doesn't really affect the
production environment.
2025-04-28 15:50:01 +08:00
621e095739 FIX: Also cater for fixed category positions when localizing categories (#32486)
When ordering categories,

af8e48c1e0/app/models/category_list.rb (L61-L68)

Only one of the flows do `.group("categories.id")`.

This was causing sites with `SiteSetting.fixed_category_positions=true`
to 500 when another site setting
`SiteSetting.experimental_content_localization` was enabled. (Related:
https://github.com/discourse/discourse/pull/32464).

This commit fixes the issue by also grouping on the other case.
2025-04-28 15:34:31 +08:00
af8e48c1e0 FIX: Ensure site banner hides when user clicks on close button (#32444)
Meta:
https://meta.discourse.org/t/clicking-x-to-close-welcome-banner-does-not-work-until-page-refresh/363222

The site banner is not hidden when a logged-in user clicks on the close
button.

This PR adds `@tracked` to the User model `dismissed_banner_key`
property so it is autotracked correctly by `DiscourseBanner` [`visible`
getter](https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/components/discourse-banner.gjs#L34-L49).
2025-04-28 14:00:39 +08:00
3146142c2e DEV: Create topic and post localization resources (#32440)
This commit adds

- `topic_localization` containing its topic, a locale, title, and
fancy_title
- `post_localization` containing its post, a locale, raw, cooked, the
associated post's version
- and also APIs to add them

Reviewer note: We may ask ourselves "why create separate models instead
of one that is generic?" but the different localizable models may be
vastly different. For example in posts we only have raw that we need to
translate, and topics we have only title, but for categories we have
name and description. Then, we may ask ourselves "why not create a
polymorphic one that takes in model and column name?" and then we end up
with the same thing as what we have currently which is custom fields
(which is a mess in itself). Also, when replacing the untranslated
content to the translated one, we may find it easier to just `join` +
`coalesce` on the dedicated table - it would be a much simpler query
than polymorphism.
2025-04-28 12:16:14 +08:00
cdb047ca29 FEATURE: Show localized categories route (#32464)
Earlier on in https://github.com/discourse/discourse/pull/32380 we
started showing localized categories on /latest and in the sidebar, but
it missed out /categories as it takes a different route.

This PR updates our CategoryList to also query for localizations and use
them if they exist.

<img width="1377" alt="Screenshot 2025-04-25 at 5 43 49 PM"
src="https://github.com/user-attachments/assets/d1049ec7-3909-40b2-92f6-b810f4366356"
/>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-04-28 11:57:46 +08:00
20c0e8a7e2 FIX: Don't null out category attributes if no param keys (#32483)
This is a bug introduced by me by thinking the lonely operator is redundant here. It is not. Sometimes the param keys are not sent, and when they aren't we should preserve the existing attribute value, not null it out.

This PR fixes that and also adds a regression test explaining why it's needed.
2025-04-28 11:28:23 +08:00
5e2edce3ad FIX: Also show localized categories for users who are not logged in (#32465)
A rework of https://github.com/discourse/discourse/pull/32460.

In the earlier PR that had to be reverted, we were directly deleting
cache (redis) and it was causing our image build to fail (see dev chat).

In this commit, we will rely on the existing method of invalid the keys
(which essentially will cause the next request to get the new site json
since the seq is not the same).
2025-04-28 11:19:58 +08:00
ffa2c192bf FIX: rich editor link backspace edge case (#32476) 2025-04-27 23:45:46 -03:00
7b062e24de DEV: refactor load-more component to glimmer and use intersection observer (#32285)
This PR makes the following key changes to the load-more component:

* Updating to a Glimmer component
* Changing from an eyeline/scrolling-based mechanism to an
IntersectionObserver to determine when to load
* Keeping track of a single invisible sentinel element to help trigger
the loadMore action instead of having to find and track the last item of
the collection upon every load
* The component can now be used without wrapping around some content to
be yielded - the intent is to use this for cases like
[DiscoveryTopicsList](f0057c7353/app/assets/javascripts/discourse/app/components/discovery/topics.gjs (L222))
where we might want more precise placement of the sentinel element.
* Added utility toggle functions to control observer behaviour in this
class for testing

We will replace the load-more mixin in DiscoveryTopicsList in another
PR.



https://github.com/user-attachments/assets/50d9763f-b5f8-40f6-8630-41bdf107baf7


### Technical Considerations
1. Keeping track of a single sentinel element simplifies the logic
greatly and is also more robust to changes in the collection that's
being loaded. (ref: a [previous
commit](2279519081)
that was following the previous approach of tracking specifically the
last item of the loaded collection); this also sidesteps odd edge cases
like if the tracked element is larger than the entire viewport.
2. Using
[isIntersecting](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserverEntry/isIntersecting)
instead of calculating manually whether the element is in the viewport
is also less flaky - I ran into issues with the boundingClientRect
inconsistently being calculated as outside the viewport on different
sized screens.
3. We need to properly bind `loadMore` functions with the action
decorator, otherwise the way we pass the loadMore callbacks through to
the observe-intersection modifier results in attempting to call it on
the loadMore component context instead. I've done this for all such
functions except for the one in
[`category-list`](0ed4b09527/app/assets/javascripts/discourse/app/models/category-list.js (L117))
which uses `@bind` that should be equivalent in terms of binding to the
correct `this`.
2025-04-28 10:22:35 +08:00
58332eaec2 Build(deps): Bump faraday from 2.13.0 to 2.13.1 (#32481)
Bumps [faraday](https://github.com/lostisland/faraday) from 2.13.0 to
2.13.1.
- [Release notes](https://github.com/lostisland/faraday/releases)
-
[Changelog](https://github.com/lostisland/faraday/blob/main/CHANGELOG.md)
-
[Commits](https://github.com/lostisland/faraday/compare/v2.13.0...v2.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-28 01:24:56 +02:00
8e24d6a724 Build(deps): Bump json from 2.11.2 to 2.11.3 (#32482)
Bumps [json](https://github.com/ruby/json) from 2.11.2 to 2.11.3.
- [Release notes](https://github.com/ruby/json/releases)
- [Changelog](https://github.com/ruby/json/blob/master/CHANGES.md)
- [Commits](https://github.com/ruby/json/commits/v2.11.3)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-28 01:24:49 +02:00
948d9c096d Build(deps-dev): Bump shoulda-matchers from 6.4.0 to 6.5.0 (#32480)
Bumps [shoulda-matchers](https://github.com/thoughtbot/shoulda-matchers)
from 6.4.0 to 6.5.0.
- [Release
notes](https://github.com/thoughtbot/shoulda-matchers/releases)
-
[Changelog](https://github.com/thoughtbot/shoulda-matchers/blob/main/CHANGELOG.md)
-
[Commits](https://github.com/thoughtbot/shoulda-matchers/compare/v6.4.0...v6.5.0)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-28 01:18:06 +02:00
fbc2cfb618 DEV: Refactor moment.js loading (#32337)
- Load moment and moment-timezone-with-data via webpack import instead
of including copies in every locale file

- Fetch static files from node_modules instead of `vendor/`

This cuts the size of locale-specific JS files in half, since they no
longer include moment itself.
2025-04-26 13:52:07 +01:00
13ea673d18 UX: fix rich editor placeholder being cut on mobile (#32474)
After adjusting an overflow on the rich editor placeholder, it started
being cut on mobile, as the parent paragraph can be smaller than the
area the placeholder takes.

This fixes it by returning the `position: relative` to the
`.ProseMirror` editor, which also fixes some weird positioning errors
for "fake" cursors (gap cursor, codemark cursor, drop cursor) and
absolute-positioned elements that relied upon the editor being
`position: relative`.
2025-04-26 08:22:06 -03:00
0b5067132b Build(deps-dev): Bump @swc/core from 1.11.21 to 1.11.22 (#32427)
Bumps [@swc/core](https://github.com/swc-project/swc) from 1.11.21 to
1.11.22.
- [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.21...v1.11.22)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-26 10:52:00 +01:00
aafbde2080 DEV: Convert final hbs to gjs and enable require-strict-mode lint (#32473) 2025-04-26 10:48:43 +01:00
acc11cc9aa DEV: Remove final {{action uses and enable lint rule (#32348) 2025-04-25 21:25:06 +01:00
ca658a8bb0 A11Y: add H1 tags for screenreaders on discovery routes (#32422)
Over the years we've received multiple pieces of feedback around our
lack of meaningful H1 tags on our topic lists.

This adds an `<H1>`, hidden with `.sr-only`, for screenreaders that
describes the content of our discovery routes. I've tried to keep these
structured in a way that's somewhat consistent and uses natural
language.

The translations could probably be more efficiently structured, but I
think we need a good amount of flexibility here for translators to
change the sentence structure.

Ultimately this means people using screenreaders will know which page
they're on while navigating headings... and without having to parse
through our navigation.

For example (made visible to demonstrate):


![image](https://github.com/user-attachments/assets/ae397317-b167-44b9-9dfa-79ddd8f9dfda)


![image](https://github.com/user-attachments/assets/fbdb8c49-03ed-40af-ae21-c7eb841f3d3e)


![image](https://github.com/user-attachments/assets/8f36da9d-04cb-4c6b-a4c3-baffbecc64e5)


![image](https://github.com/user-attachments/assets/fc9f3f8d-35a1-4953-84cf-337a00077e26)
2025-04-25 15:08:37 -04:00
ccbf88eb98 DEV: remove wrapping span from full-page-search-below-search-info outlet (#32472)
This span renders even when the plugin outlet isn't being used, so it
can get in the way. I did a quick search and don't see it targeted
anywhere obvious (it would be difficult to do without a unique class
anyway)
2025-04-25 14:50:23 -04:00
e3c3cfe083 UX: Unhide the rich_editor site setting (#32455)
This will show the experimental rich_editor setting and admins
can turn it on for their site. It is still marked experimental
because there are some features missing, but it works well for
95% of cases.


---------

Co-authored-by: Renato Atilio <renato@discourse.org>
2025-04-25 15:00:21 -03:00
d166746aa2 Build(deps-dev): Bump webpack from 5.99.5 to 5.99.6 (#32374)
Bumps [webpack](https://github.com/webpack/webpack) from 5.99.5 to
5.99.6.
- [Release notes](https://github.com/webpack/webpack/releases)
-
[Commits](https://github.com/webpack/webpack/compare/v5.99.5...v5.99.6)

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Discourse CI <ci@ci.invalid>
2025-04-25 16:20:59 +01:00
6a1dc50895 DEV: Stop running core annotations check as a standalone job (#32470)
Merging the core annotation check into the core backend job reduces the
number of runners required per workflow from 15 to 14. Before this
change, the core annotations job occupies a runner for about 1 min
30 secs in order to spend 9 seconds running the core annotations check.
2025-04-25 23:18:55 +08:00
bc94909763 DEV: Bump tests workflow build job timeout for plugin system tests (#32469)
While the step to run plugin system tests has been set with a timeout of
30 minutes, the overall job timeout was only set to 20 minutes. As a
result, we are starting to see the plugin system tests job fail due to
the job exceeding the 20 minutes timeout.

### Reviewer notes 

Example of plugin system tests exceeding 20 minutes timeout:
https://github.com/discourse/discourse/actions/runs/14665943355/job/41160611627
2025-04-25 16:55:11 +02:00
920d854717 UX: adjust search blurb text (#32467)
Before:

![image](https://github.com/user-attachments/assets/72ada716-4a4a-4f91-9d7e-07b2ab89e72a)


After: 

![image](https://github.com/user-attachments/assets/cd7622be-94cd-47d4-8d0a-8efbd05ec324)
2025-04-25 10:30:59 -04:00
ec07291cf6 Build(deps): Bump @csstools/postcss-light-dark-function from 2.0.7 to 2.0.8 (#32375)
Bumps
[@csstools/postcss-light-dark-function](https://github.com/csstools/postcss-plugins/tree/HEAD/plugins/postcss-light-dark-function)
from 2.0.7 to 2.0.8.
-
[Changelog](https://github.com/csstools/postcss-plugins/blob/main/plugins/postcss-light-dark-function/CHANGELOG.md)
-
[Commits](https://github.com/csstools/postcss-plugins/commits/HEAD/plugins/postcss-light-dark-function)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-25 14:37:07 +01:00
483d5dadff Build(deps): Bump rqrcode_core from 1.2.0 to 2.0.0 (#32454)
Bumps [rqrcode_core](https://github.com/whomwah/rqrcode_core) from 1.2.0
to 2.0.0.
- [Release notes](https://github.com/whomwah/rqrcode_core/releases)
-
[Changelog](https://github.com/whomwah/rqrcode_core/blob/main/CHANGELOG.md)
-
[Commits](https://github.com/whomwah/rqrcode_core/compare/v1.2.0...v2.0.0)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-25 14:36:31 +01:00
0f9d1b9b3d Build(deps-dev): Bump puppeteer-core from 24.7.1 to 24.7.2 (#32451)
Bumps [puppeteer-core](https://github.com/puppeteer/puppeteer) from
24.7.1 to 24.7.2.
- [Release notes](https://github.com/puppeteer/puppeteer/releases)
-
[Changelog](https://github.com/puppeteer/puppeteer/blob/main/CHANGELOG.md)
-
[Commits](https://github.com/puppeteer/puppeteer/compare/puppeteer-core-v24.7.1...puppeteer-core-v24.7.2)

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Discourse CI <ci@ci.invalid>
2025-04-25 14:36:26 +01:00