Commit Graph

59261 Commits

Author SHA1 Message Date
b4a4dc864b FIX: Background body regressed in #32517 (#32527)
Previously only mobile had body background, so that change made it cover
the html backround (as seen on meta)
2025-04-30 12:02:51 +02:00
edbd5e08f9 DEV: Refactor StartReply & StopReply services a bit
- Move some data transforming into contracts.
- Add some missing specs.
- Use the `try` step.
- Improve the `model` step a bit by allowing to catch any exception,
  and not only `ArgumentError`. We already had the mechanism to inspect
  which exception was caught.
2025-04-30 11:50:22 +02:00
7d8a1df6cd DEV: Add locale to post table (#32526)
Adding a `locale` column to the post table, so that we can localize
posts.
2025-04-30 16:35:32 +08:00
e7450cc6da DEV: Migrate from sprockets to propshaft for assets (#32475)
We are no longer using any of the transpilation/bundling features of
Sprockets. We only use it to serve assets in development, and then
collect & fingerprint them in production. This commit switches us to use
the more modern "Propshaft" gem for that functionality.

Propshaft is much simpler than Sprockets. Instead of taking a
combination of paths + "precompile" list, Propshaft simply assumes all
files in the configured directory are required in production. Previously
we had some base paths configured quite high in the directory structure,
and then only precompiled selected assets within the directory. That's
no longer possible, so this commit refactors those places (mostly
plugin-related) to use dedicated directories under
`app/assets/generated/`.

Another difference is that Propshaft applies asset digests in
development as well as production. This is great for caching & dev/prod
consistency, but does mean some small changes were required in tests.

We previously had some freedom-patches applied to Sprockets. Some of
those had to be ported across to Propshaft. We now have three patches:

1. Skip adding digest hashes to webpack-generated chunks (which are
already digested, and referred to from other js files)

2. Avoid raising errors for missing assets in test mode. We don't always
compile assets before running basic RSpec tests.

3. Maintain relative paths for sourcemap URLs, so that files don't need
to be recompiled depending on their CDN path

Significant refactors are made to the `assets.rake` and `s3.rake` tasks,
which rely on implementation details of Sprockets/Propshaft.
2025-04-30 08:59:32 +01:00
fb546b6e97 DEV: use LoadMore component for discovery topics list (#32363)
Follow on from https://github.com/discourse/discourse/pull/32285:

This replaces the use of the scrolling-based load-more mixin in
DiscoveryTopicsList with the IntersectionObserver-based LoadMore
component.

I insert the LoadMore component in the parent template for more precise
control over where the sentinel element is placed - right after the List
collection.

Also lifted up the `loadMore` action to the topics glimmer component so
it can be passed directly into LoadMore, and refactored away the jquery
dependency.

This is a breaking change to the behaviour of DiscoveryTopicsList, so
it'll require updates to any other repositories depending on this
component.
2025-04-30 14:49:20 +08:00
5601b73e7a DEV: Fix broken migration tests (#32525) 2025-04-30 12:55:00 +08:00
d4b6f04ab0 DEV: Customization enhancements for the Glimmer Post Stream (#32063)
This commit introduces various enhancements and refactoring to the
Glimmer Post Stream codebase, focusing on the integration and usage of
`PluginOutlet` components, improved handling of post attributes, and the
introduction of new properties and methods. Key changes include:

1. **`PluginOutlet` Integration**:
- Added `PluginOutlet` components across multiple files, such as
`post.gjs`, `post/avatar.gjs`, and `post-stream.js`, to allow plugins to
extend the functionality of posts, avatars, and metadata more
effectively.
- Introduced `postOutletArgs` to pass structured arguments, enabling
better customization and extensibility for plugins.
- Added PluginOutlet usage in `post/avatar.gjs` for avatar-related
customizations.

2. **Refactored Post Attributes**:
- Enhanced handling of post attributes by deprecating the
`includePostAttributes` method in favor of `addTrackedPostProperties`
for improved compatibility with the Glimmer Post Stream.
- Added a new `isSmallAction` computed property to the `Post` model to
identify small actions or split topics.

3. **Improved Query Parameters**:
- Introduced `topicPageQueryParams` to manage query parameters for
topics more effectively, facilitating smoother updates and interactions
in components that won't need to inject the topic controller or the
router service to get these parameter values.

---------

Co-authored-by: David Taylor <david@taylorhq.com>
2025-04-29 22:24:13 -03:00
5f21acd190 Build(deps): Bump net-imap from 0.5.7 to 0.5.8 (#32522)
Bumps [net-imap](https://github.com/ruby/net-imap) from 0.5.7 to 0.5.8.
- [Release notes](https://github.com/ruby/net-imap/releases)
- [Commits](https://github.com/ruby/net-imap/compare/v0.5.7...v0.5.8)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-30 01:12:13 +02:00
0ff9c7c27e Build(deps-dev): Bump @swc/core from 1.11.22 to 1.11.24 (#32520)
[//]: # (dependabot-start)
⚠️  **Dependabot is rebasing this PR** ⚠️ 

Rebasing might not happen immediately, so don't worry if this takes some
time.

Note: if you make any changes to this PR yourself, they will take
precedence over the rebase.

---

[//]: # (dependabot-end)

Bumps [@swc/core](https://github.com/swc-project/swc) from 1.11.22 to
1.11.24.
- [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.22...v1.11.24)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-30 01:11:27 +02:00
203281815b Build(deps): Bump core-js from 3.41.0 to 3.42.0 (#32519)
Bumps
[core-js](https://github.com/zloirock/core-js/tree/HEAD/packages/core-js)
from 3.41.0 to 3.42.0.
- [Release notes](https://github.com/zloirock/core-js/releases)
-
[Changelog](https://github.com/zloirock/core-js/blob/master/CHANGELOG.md)
-
[Commits](https://github.com/zloirock/core-js/commits/v3.42.0/packages/core-js)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-30 01:11:08 +02:00
Sam
067813e182 DEV: add extra safety around original post only implementation (#32521)
Instead of looking at post count that is cached, only ever look at the
post_number
which is guaranteed to be correct
2025-04-30 08:45:28 +10:00
5702cc9250 DEV: Enable migrated_site flag during bulk imports (#32256)
Extend the `import_site_settings` import step to enable the
`migrated_site` flag if possible.

It also includes an escape hatch via the
`SKIP_MIGRATED_SITE_FLAG_UPDATE` flag for cases where you really don't
want to toggle it on.
2025-04-29 22:00:48 +00:00
97bcbe1716 Update translations (#32510) 2025-04-30 07:59:22 +10:00
9603cb63d0 REFACTOR: merge /desktop and /mobile discourse.scss into /common (#32517)
This removes `/mobile/discourse.scss` and `/desktop/discourse.scss` and
moves the required styles into `/common/discourse.scss`

I was also able to remove some unused/redundant CSS and update
breakpoints to our new formatting.

There are some visual changes, most notably on mobile forms... but these
all appear to be minor and get us more consistency across breakpoints.

For example... Before/After with desktop below... mobile actually
appeared to be a little broken



![image](https://github.com/user-attachments/assets/7b733bfa-812e-4e5b-ba04-c8df78526fe1)


![image](https://github.com/user-attachments/assets/a3fead6f-6c93-4619-b288-f6dcfd144e01)


![image](https://github.com/user-attachments/assets/bb26060c-a453-4ff2-ab13-67e17af84d59)

---------

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
2025-04-29 16:37:43 -04:00
4e760f7b79 FIX: don't error when no filter is set in discovery heading (#32516)
In some rare cases, plugins can add nav items without a filter. For
example, the ActivityPub plugin does this. The recent change in
https://github.com/discourse/discourse/pull/32422 results in a JS error
on those pages, see report in
https://meta.discourse.org/t/list-of-activitypub-followers-of-a-tag-actor-not-shown-on-discourse-meta/363971

This fixes the issue.
2025-04-29 11:40:11 -04:00
b0f939b36d DEV: Add /admin/users.json to the api docs (#32512)
A user on meta was asking about this endpoint so we should add it to the
api docs.

See: https://meta.discourse.org/t/363641
2025-04-29 09:28:47 -06:00
4013976403 DEV: Abstract method for checking navigationMode in service (#32515)
I want this method in the AI plugin.
2025-04-29 10:02:44 -05:00
3047a1100c DEV: Add missing dependencies (#32514) 2025-04-29 15:59:22 +02:00
1ede31b704 DEV: Update topic solutions import for new table structure (generic_bulk.rb) (#32051) 2025-04-29 10:43:59 +00:00
ed1e0e30f2 DEV: Remove full_page_login setting (#32189)
We are making this the only option for our login/signup
pages on April 29th, 2025, per

https://meta.discourse.org/t/introducing-our-new-fullscreen-signup-and-login-pages/340401.

This commit removes the `full_page_login` setting and any logic
around it, as well as deleting the old login and signup modals,
and removing leftover problem checks and settings from the database.
2025-04-29 10:40:40 +02:00
19626bc75a DEV: move select-kit plugin-api file to lib directory (#32507)
Lift and shift, this file ceased to be a mixin as of
https://github.com/discourse/discourse/pull/28467.
2025-04-29 15:50:15 +08:00
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