Commit Graph

10616 Commits

Author SHA1 Message Date
1de8960d2a FIX: Serve RTL CSS for themes and components (#32916)
Follow up to https://github.com/discourse/discourse/pull/32881

Stylesheet `<link>` tags for themes/components are aren't getting
included/rendered in the HTML document due to a missing check in
stylesheet manager. See
https://meta.discourse.org/t/ui-layout-broken-for-rtl-language-after-latest-update/367434?u=osama.
2025-05-27 03:15:05 +03:00
b485e04e4f FEATURE: Also localize banners (#32908)
Banners take a different route and are retrieved separately.
2025-05-26 13:16:22 +08:00
b4990ccb71 DEV: Compile and serve rtl versions of theme CSS (#32881) 2025-05-23 13:48:57 +01:00
e2fe5671ed DEV: Resolve mixed-decls misconfiguration (#32858)
Marking mixed-decls as silenced & fatal simultaneously is causing a
warning "Ignoring setting to silence mixed-decls deprecation, since it
has also been made fatal"

The intention is for it to be silenced for themes/plugins, but fatal for
core.
2025-05-22 13:52:20 +01:00
1eba96a75f DEV: Remove branding and styling steps from wizard (#32797)
https://github.com/discourse/discourse/pull/32797
2025-05-21 09:46:49 +08:00
9d70336bab DEV: support un-hiding site settings programmatically (#32824)
This might be useful to revert changes made by plugins when they're
disabled for example.
2025-05-20 21:44:56 +02:00
0de08e780b UX: better error message when social login fails (#32772)
This improves the error message(s) displayed when an error happens while
using a social login to log in / sign up into a Discourse community.

Unfortunately, we can't be super precise in the reason behind the error
(it can be the user clicked "cancel" during the authorization phase, or
any of the plethora of other possible errors) because the reason isn't
provided (either for security reasons, or because it's just hard to do
so in a reliable & consistent way accross all social logins).

The best I could do was to

- add the name of the "social login" provider in the error message
- tweak the copy a bit for the different cases handle
- fix the CSS/HTML to match the one used by the main application

In order to show the name of the provider, we use either the "provider"
or the "strategy" query parameter, or use the name of the authenticator
(if it's the only one enabled).

Internal ref - t/153662

---

**BEFORE**


![before](https://github.com/user-attachments/assets/67579a3e-5a61-4e8f-aa72-4dc375547e39)

**AFTER**


![after](https://github.com/user-attachments/assets/954f9c8a-e865-44ff-b1e3-841393a26edf)
2025-05-20 16:22:38 +02:00
d86b4ff298 DEV: Remove precompile for locale js (#32799)
The Rails asset pipeline isn't used for locale bundles any more. Plus,
`assets.precompile` isn't used for anything since we switched to
propshaft.
2025-05-19 11:08:01 +01:00
41363a2a18 DEV: Silence scss mixed-decls for themes/plugins (#32750)
Fixing this everywhere will be a very large undertaking, so we're
deferring it until there is a concrete timeline for it becoming an error
in sass.

In the meantime, we'll be adding a stylelint rule to enforce ordering of
declarations/nested-blocks/mixins, so that will go some way towards
avoiding this deprecation.
2025-05-16 13:06:10 +01:00
d564386066 UX: Add discourse text icon (#32744)
![CleanShot 2025-05-15 at 12 02
49@2x](https://github.com/user-attachments/assets/eacf0376-4491-4fcd-8e7e-c052564f0093)
2025-05-15 15:58:32 +02:00
d90b03f3bf DEV: Remove deprecated/archived theme from CI (#32747) 2025-05-15 13:04:43 +01:00
4df5638b3f DEV: Remove discourse-logster-rate-limit-checker from official plugins (#32727)
This is a plugin that is no longer maintained.
2025-05-15 09:10:15 +08:00
267736e5bc DEV: Show login-required splash in root route (take 2) (#32629) 2025-05-14 11:25:43 -04:00
c8d49a4d0a UX: split admin logo and fonts to separate pages (#32700)
Before we had logo and fonts page merged together. Decided to split
them.
2025-05-14 14:02:34 +08:00
4d99c839b6 FEATURE: porting type object to site settings (#32706) 2025-05-13 14:30:24 -03:00
da111d87bd DEV: adds unregister_locale (#32676)
Running this spec locally I was getting an error:

```
  1) translate accelerator plugins loads plural rules from plugins
     Failure/Error: DiscoursePluginRegistry.unregister_locale("foo")

     NoMethodError:
       undefined method `unregister_locale' for class DiscoursePluginRegistry
     # ./spec/lib/freedom_patches/translate_accelerator_spec.rb:113:in `block (3 levels) in <main>'

Finished in 0.17998 seconds (files took 1.88 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./spec/lib/freedom_patches/translate_accelerator_spec.rb:117 # translate accelerator plugins loads plural rules from plugins
```

On top of this, this spec was flakey, Im not sure this is going to fix
flakyness, but this seems like a good first step.
2025-05-10 19:50:00 +02:00
f3c41af772 DEV: Refactor image compression for iOS (#32652) 2025-05-09 09:51:30 -04:00
90c19ee54d DEV: remove email updater debugging (#32664) 2025-05-09 15:11:11 +04:00
b28df068fc FIX: ensure old email set correctly when updating email (#32309)
Previously when changing back to the same email (ie. change to new
email, then change back again) we can easily end up showing the
incorrect old email if changing back to the same email more than once.
Then passing the incorrect old email causes an error as it can't be found.

This happens because we only searched for a combination of `user_id` and
`new_email` which can load an older change from the database. By using
the current email address when finding / initializing the
`EmailChangeRequest` we can prevent this issue as we will be creating a
new entry rather than loading an outdated one.
2025-05-09 12:50:01 +04:00
6154fa6b45 FEATURE: Add translations to posts (#32564)
## 🔍 Overview
This update adds the ability for users to manually add translations to
specific posts. It adds a 🌐 icon on the post menu where you can click to
add translations for posts.

It also introduces a new site setting:
`content_localization_debug_allowed_groups` which is convenient when
debugging localized posts. It adds a globe icon in the post meta data
area along with a number of how many languages the post is translated
in. Hovering over the icon will show a tooltip with access to editing
and deleting the translated posts.

## 📸 Screenshots
<img width="1234" alt="Screenshot 2025-05-07 at 13 26 09"
src="https://github.com/user-attachments/assets/9d65374d-ee3e-4e8b-b171-b98db6f90f23"
/>
<img width="300" alt="Screenshot 2025-05-07 at 13 26 41"
src="https://github.com/user-attachments/assets/6ee9c5e6-16ed-4dab-97ec-9401804a4ac8"
/>
2025-05-08 10:40:36 -07:00
4d9bc4fef4 DEV: More helper methods for topic localization (#32643)
This adds more methods on `Topic` so it can be used in a later PR that
will localize topics.
2025-05-08 16:12:28 +08:00
413fea8051 DEV: Add new key for anon cache for localization (#32640)
As we move content localization to core, we will need to register a new
key to handle cases when anon users hit the cache to avoid cache
poisoning.

Related:
- https://github.com/discourse/discourse-translator/pull/273
-
d7ae611981/lib/discourse_translator/inline_translation.rb (L94-L98)
2025-05-08 14:30:03 +08:00
4490a52976 DEV: Recover from missing ember-cli assets in development (#32625) 2025-05-07 14:42:32 -04:00
b16fb6a60b FIX: Ensure hashtag_lookup falls back to system user if post user is deleted (#32466)
`hashtag_lookup` fails if called with a deleted user's ID. This change
defaults to system user if the user does not exist.
2025-05-07 15:49:49 +10:00
54faff1608 DEV: Add a missing path to the stylesheet watcher (#32579)
A followup to https://github.com/discourse/discourse/pull/31416

---------

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2025-05-05 19:31:39 +02:00
49e3b5be76 Bump version to v3.5.0.beta5-dev 2025-05-05 12:58:30 -04:00
133b230ed9 Bump version to v3.5.0.beta4 2025-05-05 12:58:30 -04:00
3492819c19 DEV: Don't allow context-free system post destruction (#32523)
There are instances of posts being deleted by system_user where the context is left blank in the staff action logs, leading to confusion about why exactly they have been deleted.

This change deprecates using the PostDestroyer as system_user without providing a context, and adds a context to all call sites currently missing it in core. Plugins to be done after this is merged.
2025-05-05 09:58:29 +08:00
ffa406b0b1 UX: Add more info to theme cards (#32334)
Demo:
<img width="1431" alt="Screenshot 2025-05-02 at 2 24 41 pm"
src="https://github.com/user-attachments/assets/c8ec824e-25df-4efc-a4be-c774a2a97896"
/>
<img width="1480" alt="Screenshot 2025-05-02 at 2 24 32 pm"
src="https://github.com/user-attachments/assets/a4020283-9b6d-4f5e-a8c2-72b7608a6026"
/>

Mobile:
<img width="424" alt="Screenshot 2025-05-02 at 2 25 29 pm"
src="https://github.com/user-attachments/assets/af68669a-7bb4-46dc-92ab-6ecc7a3f3842"
/>
<img width="421" alt="Screenshot 2025-05-02 at 2 25 36 pm"
src="https://github.com/user-attachments/assets/961d9f5c-8010-4c5f-a319-6e356b088667"
/>
2025-05-05 09:06:05 +08:00
ba7311d807 DEV: remove fa remapping logic (#32478)
Follow up to https://github.com/discourse/discourse/pull/31866, we are
removing the FA name mappings from the codebase. Timeline is mentioned
in Meta topic
https://meta.discourse.org/t/were-upgrading-our-icons-to-font-awesome-6/325349:

> Start May 2025 - removal of old icon names mapping and error level
logging

We'll be merging this in on the 2nd May.

---------

Co-authored-by: Ted Johansson <ted@discourse.org>
2025-05-02 10:20:21 +08:00
4d0a817f40 DEV: Compile 'common' CSS into own assets (#31416)
Previously we were compiling core and theme CSS into two targets:
Desktop and Mobile. The majority of both files was the 'common' css.
This commit splits those common styles into their own targets so that
there is less duplication. This should improve compilation times + cache
reuse, as well as opening the door for experiments with
media-query-based mobile-modes.

The only functional change is that we can no longer use `@extend` to
copy 'common' rules in core to mobile/desktop. This is probably for the
best. Duplication and/or mixins are a more native-css pattern for this.

Plugins already have a common / mobile / desktop pattern, so are
unchanged by this commit.
2025-05-01 10:44:49 +01: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
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
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 2025-04-29 12:26:54 +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
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
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
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
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
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
2dfafe3fd2 DEV: Report runtime duration of each parallel test process (#32457)
This information is generally useful to know and it simple for us to
instrument.
2025-04-25 15:23:53 +08:00
588caa60b9 UX: Add missing discourse-table SVG icon (#32447)
Meta:
https://meta.discourse.org/t/icon-missing-in-admin-panel-after-updating-discourse-today/363295

The `discourse-table` icon usage was introduced in
464726d973.
However, the SVG doesn't exist in core, but instead in the [AI
plugin](https://github.com/discourse/discourse-ai/blob/main/svg-icons/icons-sprite.svg?short_path=9d0511c).

The PR adds this SVG icon to the core.
2025-04-24 13:45:24 -04:00
25938208ff FIX: recalculate respects default invitee trust level (#32393)
Currently, trust level is calculated with this formula:
`[granted_trust_level, previous_trust_level,
SiteSetting.default_trust_level].max`

When a user is invited, SiteSetting.default_invitee_trust_level should
be respected in that calculation.
2025-04-23 09:49:44 +08:00
0252712008 DEV: Add --exclude-pattern to bin/turbo_rspec (#32390)
This commit adds a new `--exclude-pattern` CLI option which supports
excluding files using unix style pattern matching.

This is to simplify a couple of situations:

1. Running `bin/turbo_rspec plugin/spec` but we want to exclude all
   tests in the `plugin/spec/system` folder.

   Example: `bin/turbo_rspec --exclude-pattern="*spec/system*"
plugin/spec`

2. Running `bin/turbo_rspec plugin/*/spec/system` but we want to exclude
   tests for a particular plugin.

   Example: `bin/turbo_rspec --exclude-pattern="plugins/chat/*"
plugin/*/spec/system`
2025-04-22 11:34:48 +08:00
72f9714ddc FEATURE: Implement tag group selection in dropdown and multi-select for topic creation and preview when using Form Templates (#32108)
Adds support for a tag-chooser in form templates. It supports single tag
and multi tags. The source of the displayed tags has to be a tag_group
name.

---------

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2025-04-17 08:38:03 -05:00
918aa0fbec DEV: Add :sidekiq_job_error DiscourseEvent (#32307)
This commit adds a `:sidekiq_job_error` event which is
triggered when an error is encountered while running a Sidekiq job. The
intent of this change is to complement the `:sidekq_job_ran` event which
can be used with the `:sidekiq_job_error` event to calculate the error
rate for each job.
2025-04-17 15:41:58 +08:00
a69a304f11 FEATURE: allow edit custom flags (#32344)
Allow admins to edit user custom flags. Because changing
name/description will update name/description for old reviewables,
warning has to be displayed.

Still, system flags can never be edited or deleted (only disabled).
2025-04-17 12:31:52 +08:00
3d689bbbc2 DEV: Raise exception for deprecations in core stylesheets (#31894) 2025-04-16 16:36:41 +01:00
f3d3c61754 PERF: Reuse existing core JS build where possible (#32311)
Building the Discourse JS app is very resource-intensive. This commit
introduces an `assemble_ember_build` script which will check the
existing content of the `dist/` directory and re-use the core build if
possible. Plugins will always be rebuilt.

For now, this functionality is only useful for multi-stage (i.e.
non-standard) Discourse deployments. But in future, this script may be
extended to pull the contents of the `dist/` directory from a remote
location.
2025-04-15 16:18:22 +01:00