Commit Graph
1826 Commits
Author SHA1 Message Date
David Battersby 2fa5d0dfed DEV: remove experimental lightbox site setting (#36377)
Follow up to #36375 to remove the redundant site setting from the
database.
2025-12-03 15:54:10 +04:00
Gary Pendergast ced8c2c127 FIX: UserDestroyer should unclaim any claimed reviewables. (#36277)
When a user has been destroyed, any claimed reviewables belonging to
that user are partially orphaned, which the review queue doesn't know
how to handle. Ensuring those reviewables are unclaimed (and cleaning up
any orphaned claims on existing sites) ensures the review queue is able
to cleanly handle claimed reviewables.
2025-11-27 13:54:48 +11:00
Sérgio Saquetim c2c1cd978e DEV: Purge the widget rendering system (#36109)
This commit removes the legacy widget rendering system from the Discourse codebase.

See the topics below for more information:

- https://meta.discourse.org/t/upcoming-eol-for-the-widget-rendering-system/375332
- https://meta.discourse.org/t/upcoming-post-stream-changes-how-to-prepare-themes-and-plugins/372063
2025-11-26 16:10:02 -03:00
KrisandYuriy Kurant 27854ac8e7 A11Y: add aria-label to automatically generated heading anchor links in posts (#36232)
Currently our automatically generated anchor links for headings in posts
are pretty awful to listen to in screenreaders, because screenreaders
are reading the `name` attribute.

Here's an example from a [Meta
post](https://meta.discourse.org/t/a-new-review-queue-layout-with-all-new-features/388194)...
this "A refreshed layout" heading reads like:

 "p-1888119-a-refreshed-layout-1" 

This PR adds `aria-label="heading link"` so now this would read like:

"Heading link, same page link, A Refreshed Layout, heading level 1"

I've added a migration so posts with headings will rebake with the
improved markup.

---------

Co-authored-by: Yuriy Kurant <yuriy@discourse.org>
2025-11-25 18:29:20 -05:00
Mark Doerr 15e8a8042f Add user_anonymized webhook event (#36208)
This change adds webhook support for the user anonymization event,
allowing external systems to be notified when a user is anonymized in
Discourse.

Changes:
- Add user_anonymized event type (ID: 310) to WebHookEventType
- Wires up DiscourseEvent listener to trigger webhooks on anonymization
- Add translation string for the event in admin UI
- Add database fixture to seed the event type
- Add comprehensive test coverage

The webhook is triggered when UserAnonymizer.make_anonymous is called
and sends the anonymized user data using WebHookUserSerializer.

Nudged along the path by Claude Code
2025-11-25 07:43:16 -08:00
Gary Pendergast 57f2f5a5ea DEV: Log Reviewable actions (#36076)
With reviewables now being able to have multiple actions performed on
them, we don't want to update the final reviewable state until an action
from every action bundle has been performed.

This change makes use of the new `ReviewableActionLog`, logging actions
when they occur, then checking to see if a reviewable has had all
actions performed before finalising it.
2025-11-20 13:41:40 +11:00
Gary Pendergast 4a7032f56b DEV: Add a new ReviewableActionLog model. (#36057)
As part of the review queue refresh, moderators will be able to perform
individual actions on each part of a reviewable (for example, hiding a
post, and suspending the user). In order to know when a reviewable is
"completed", we need to be able to check that the right number of
actions have been performed on the reviewable.

This change adds a `ReviewableActionLog` model where we can keep track
of the actions that have been performed on each reviewable.
2025-11-17 15:45:33 +11:00
Natalie Tay 3abbe33018 DEV: Add locale to tags (#35979)
As part of localizing tags, we want to also add locale attribute to
tags.

This commit is standalone so as to not bloat the future ones for review. (we
will be adding slug column + controller changes in a single future PR)

Part 2 of many

- https://github.com/discourse/discourse/pull/35962
- t/153419
2025-11-12 13:12:43 +08:00
Natalie Tay 28671fae10 DEV: Add tag localization tables (#35962)
We want to start localizing tags, so introducing the tables first.

Part 1 of many

t/153419
2025-11-11 20:39:54 +08:00
Gabriel Grubba 42a0ee0884 FIX: csv import not being casing aware for tag groups (#35837)
Relates to
https://meta.discourse.org/t/tag-taggroup-csv-import-is-case-aware-but-its-not/381450
2025-11-10 11:34:23 -03:00
Martin Brennan 5f654e4c9b FIX: Possible null column for watched precedence over muted migration (#35815)
Followup 93862b98dd

There still is a slight window between the pre and post deploy migration
for this setting where we can end up with a UserOption row with a null
watched_precedence_over_muted value. This commit adds a safeguard to the
post-migration script to handle that case.
2025-11-05 10:12:21 +10:00
Martin Brennan 129d157b3c DEV: Partially move watched_precedence_over_muted migration to post-migration phase (#35755)
The change_column_null and change_column_default operations for the
watched_precedence_over_muted column have been moved from the
pre-migration
script to the post-migration script. This adjustment ensures that the
column
is only modified after all data transformations are complete, reducing
the
risk of data integrity issues during the migration process.

We have already seen this once in production, where a later failed
migration left the column in a bad state.
2025-11-03 16:04:14 +10:00
Martin Brennanandawesomerobot d4ac43e605 FEATURE: Upcoming changes part 1 (#34617)
This PR introduces part one of the "Upcoming changes" interface for
Discourse admins.

The upcoming changes feature is an enhancement around our existing
site-setting based feature flagging and experiments system. With some
light metadata, we can give admins a much better overview of the current
work we are doing, with ways for them to opt-out in early stages and
opt-in to things that we haven’t yet turned on by default for them.

This system, along with encouraging a more liberal use of site setting
flags for features, experiments, and refactors in the app, should
minimise the problem of breakages and disruptions for all Discourse
users. It is also our intent with this system for it to be easier for
designers to add and remove these changes.

Finally, it also gives us a kind of running changelog that we can use to
communicate with site owners before releases and “What’s new?” updates.

### FOR REVIEWERS

This initial PR is gated behind a hidden `enable_upcoming_changes` site
setting, because there is still more work to do before we reveal this to
admins.

To test the UI, you can add this metadata under any boolean-based site
setting, though upcoming change settings will specifically be hidden:

```
upcoming_change:
   status: "alpha" (see UpcomingChanges.statuses.keys)
   impact: "feature,staff" (feature|other for the first part, staff|admins|moderators|all_members|developers for the second part)
   learn_more_url: "https://some.url"
```

To test the images, add an image under `public/images/upcoming_changes`
with the file name as `SITE_SETTING_NAME.png`

### Interface

Admins can see the following in the interface for upcoming changes:

* The status of the change. Changes can progress along these statuses:
   * Pre-Alpha
   * Alpha
   * Beta
   * Stable
   * Permanent
* The impact of the change. This is split into Type and Role. Type can
be "Feature" or "Other" for now. Changes may affect the following roles:
   * Admins
   * Moderators
   * Staff
   * All members
* The plugin that is making the change
* The groups that are opted-in to the change. Admins can control these
groups for a gradual rollout. If a change is enabled, it is limited to
these groups.
* In some cases, an image related to the change, behind the "Preview"
link
* A link to learn more about the change

Admins can filter the changes by name, description, plugin, status,
impact type, and whether the change is enabled.

### Promotion system

For our hosted customers, we intend to have a status-based
auto-promotion system as changes progress.

For all sites, once a change reaches the Stable status, if an admin
opts-out of that change it will generate an admin problem message that
will be shown on the dashboard.

For self-hosted Discourse admins, changes will only be forcibly enabled
when they reach the Permanent state.

### Notification system

A notification system for upcoming changes so admins can stay informed
will be added in a followup PR.

---------

Co-authored-by: awesomerobot <kris.aubuchon@discourse.org>
2025-10-30 10:46:14 +10:00
Martin Brennan 93862b98dd FEATURE: Convert watched_precedence_over_muted to default site setting (#35671)
We have a setting and a user option called watched_precedence_over_muted
. This is supposed to allow members to see/be notified of topics in
categories they are watching even if those topics also include a tag the
user has muted, or vice-versa if they disable this option.

However, this setting and user option combination doesn't follow our
existing default_ user preference site setting system, where admins can
set a default for all users, but users can change the preference for
themselves. This is leading to a bug in the topic feed logic.

If the site setting watched_precedence_over_muted is set to true, and
the user preference is set to false, the user preference is essentially
ignored. This will lead to users seeing topics with muted tags inside a
watched category feed.

This commit converts watched_precedence_over_muted to a proper default
user preference site setting, which admins can set for all users at
once, then users can override individually.
2025-10-30 10:04:18 +10:00
Ted Johansson e932298486 FEATURE: Add new, unified image_quality site setting (#35467)
We recently hid multiple very technical site settings related to image quality. In this PR we add a unified image_quality setting.

Power users can still configure the individual settings (now defaulting to 0) and they will take precedence.
2025-10-29 13:17:28 +08:00
Martin Brennan c452e4275f FIX: Add extra tag_id, topic_id index to topic_tags (#35565)
In some pathological cases on the tag intersection route
for topics, when querying across multiple tags, the SQL query
planner can choose a suboptimal plan that results in a
sequential scan of the topic_tags table instead of using
the existing topic_id, tag_id index.

```
->  Parallel Seq Scan on topic_tags t2  (cost=0.00..23043.22 rows=13618 width=4) (actual time=0.031..54.114 rows=10535 loops=3)
                                                                     Filter: (tag_id = 58)
                                                                     Rows Removed by Filter: 579415
```

This resulted in a very slow query. Adding this extra
index allows us to hint the query planner to use a more
efficient plan by filtering using the tag ID first _then_ the topic ID.
2025-10-23 17:34:16 +10:00
Régis Hanol c5b32aff76 FEATURE: disable link notification user preference (#35352)
This adds a new notification's user preference to allow users to control
whether they are notified whenever one of their topic is being linked in
another post.

Internal ref - t/160259
2025-10-14 10:53:05 +02:00
Rafael dos Santos SilvaandNat d4e939d053 FEATURE: Add oneboxes and lightboxes to localized posts (#34900)
This change ensures that oneboxes, lightboxes are correctly generated
for localized posts.

The `PostLocalizer` was using `PrettyText.cook` directly, which does not
perform all the necessary post-processing steps, such as onebox
generation.

This commit introduces a new `LocalizedCookedPostProcessor` class that
is responsible for post-processing the cooked HTML of translated posts.
This new class reuses the `CookedProcessorMixin` to gain access to the
`post_process_oneboxes` method. The `PostLocalizer` is updated to use
this new processor, ensuring that oneboxes are correctly generated in
the translated content.

---------

Co-authored-by: Nat <natalie.tay@discourse.org>
2025-10-08 15:14:56 +08:00
Jarek RadoszandLoïc Guitaut 71834c898f DEV: Update rubocop-discourse to 3.13 and autofix issues (#35073)
Co-authored-by: Loïc Guitaut <loic@discourse.org>
2025-10-06 16:11:01 +02:00
Osama Sayegh 7d2256c455 FEATURE: Split setting for allowing mods to manage categories and groups (#35174)
This commit splits the `moderators_manage_categories_and_groups` setting
into 2 separate settings to allow for more precise control over
categories and groups management by moderators.

Internal topic: t/141392.
2025-10-06 10:43:42 +03:00
Osama Sayegh a7fb9e1897 FEATURE: Allow editing theme-owned palettes (#34722)
This commit allows editing colors of palettes that are installed with
themes. Prior to this commit, editing colors of theme-owned palettes wasn't
allowed because a theme update could override the edits made by admins
and there was no way to revert edits to the original values. With this
commit, all of that is solved by copying the palette when it's first edited
by an admin, and making future updates to the theme update the original
copy only with the ability for admins to revert to the colors in the
original copy at any time.

Internal topic: t/162130.
2025-10-06 09:02:39 +03:00
Rafael dos Santos SilvaandNat a40149bd1b PERF: optimize translation progress dashboard with batch query (#34861)
Replace individual per-locale queries with a single query that
calculates completion progress for all locales at once.

This commit also removes methods off the `base_candidate` (used for
Categories and Topics as well) which are not used any more, as the
progress dashboard only shows progress for posts.

t/162846/4

---------

Co-authored-by: Nat <natalie.tay@discourse.org>
2025-09-29 13:32:40 +08:00
Kelv 547d99e3b4 DEV: remove toggles for switching between jquery & floatkit autocomplete (#34867)
We've had the new floatkit-based autocomplete live in various parts of
Discourse for about a month now, and it's stable enough for us to remove
the site setting letting admins revert to the jquery-based autocomplete
library which is now deprecated.
2025-09-19 14:50:04 +08:00
Alan Guo Xiang Tan a05bb42b85 DEV: Remove unnecessary topic_timers_topic_id_trigger trigger (#34866)
This was causing restores to fail. The trigger is also unnecessary
because the `topic_id` column is already marked as read-only.

Follow-up to eeeb7d302f
2025-09-19 10:14:23 +08:00
Alan Guo Xiang Tan 04dd93fe2c DEV: Fix incorrect SyncTimerableIdTopicId migration (#34837)
Follow-up to eeeb7d302f

When `timerable_id` is `null`, `timerable_id != topic_id` will evaluate
to `null` so the row isn't updated.
2025-09-17 13:54:29 +08:00
LincaandAlan Guo Xiang Tan eeeb7d302f DEV: rename topic_id to timerable_id for BaseTimer (#34667)
To prepare for the introduction of `CategoryDefaultTimer`, which allows
posts created in certain categories to have a default TopicTimer, we
need to rename the `topic_id` column to `timerable_id`.

---------

Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
2025-09-17 13:19:17 +08:00
Ted Johansson b36747163b FEATURE: Allow hiding user fields on signup form (#34672)
We want to allow configuring fields that are both optional and editable to not show up in the signup form.

- Fields that are optional but not editable need to be on the signup form, or they can never be filled in.
- Fields that are not optional need to be on the signup form, or you can never sign up.
2025-09-15 10:42:07 +08:00
Bianca Nenciu f2b7224da4 FIX: Make web_hook_events#id a bigint (#34620)
Sites with many web hooks may come close to the limit of `int` due to
the high web hooks volume.
2025-09-04 22:20:34 +03:00
Linca ae1fe19e63 DEV: Use Single Table Inheritance in TopicTimer (#34530)
To prepare for the introduction of `CategoryDefaultTimer`, which allows
posts created in certain categories to have a default `TopicTimer`, we
first need to convert `TopicTimer` to use [Single Table
Inheritance][STI].

[STI]:
https://guides.rubyonrails.org/association_basics.html#single-table-inheritance-sti
2025-09-01 11:13:22 +08:00
Alan Guo Xiang Tan 5fafb3a55e PERF: Add index_web_hook_events_on_created_at (#34594)
Helps to speed up `WebHookEvent.purge_old` which is ran daily and
filters on the `created_at` column.
2025-08-29 15:15:39 +08:00
Natalie Tay 2daf45e5e5 FEATURE: Also allow language switcher to be shown when users are logged in (#34578)
This PR extends the current setting
`content_localization_anonymous_language_switcher` to one that can be
shown even for logged in users ->
`content_localization_language_switcher`

When logged in, the preference is saved to the `user` rather than a
cookie. 🍪



https://github.com/user-attachments/assets/b6f4d41b-4716-4020-a97d-2c3f90d54576
2025-08-27 23:01:07 +08:00
Osama Sayegh 7ee52c8f85 DEV: Remove dual mode support for palettes and drop theme-owned palettes (#34467)
We're not going to finish/release dual-mode palettes and theme-owned
palettes at this time, so we're cleaning up the code that we've already
merged for these features.

Internal topic: t/161279.
2025-08-26 06:24:11 +03:00
Martin Brennan d17f5d77f0 DEV: Delete old use_polymorphic_bookmarks site setting (#34514)
This has been unused for a _long_ time
2025-08-25 20:42:30 +10:00
Ted Johansson b24a3d81ed DEV: Allow impersonation without session swapping (#34213)
The current impersonation feature works by signing you in as the user you are impersonating. This has the side effect of invalidating your own session and forcing you to log out and in again.

In this experimental implementation you keep your existing session, but DefaultCurrentUserProvider returns the user being impersonated, allowing you to see the site from their perspective.
2025-08-21 14:18:15 +08:00
Joffrey JAFFEUX 139ddafca0 FIX: handle lower case dark (#34444)
This has been renamed in
https://github.com/discourse/discourse/commit/7a3c5410770ec0752f72ce13f87bef6601c4aa0d#diff-3498f4852039e5953487a188b9722b228d6d0bf4f054dbdcbd11c10392ac3939
and was not handled in https://github.com/discourse/discourse/pull/34351

Causing this error in migrations:

```
#<StandardError:"An error has occurred, this and all later migrations canceled:\n\nPG::InvalidTextRepresentation: ERROR:  invalid input syntax for type integer: \"dark\"\n">
```

Example record causing an issue:

```
<ColorScheme:0x00007f39e9532bc0
  id: 1,
  name: "Simple Dark",
  version: 30,
  created_at: "2017-06-06 17:26:26.281664000 +0000",
  updated_at: "2023-03-08 17:44:07.637672000 +0000",
  via_wizard: true,
  base_scheme_id: "dark",
  theme_id: nil,
  user_selectable: true>
```
2025-08-20 17:32:53 +02:00
Krzysztof Kotlarek 294e3751d4 FIX: broken base_scheme_id migration when base is default (#34430)
In this PR, migration was introduced to change the `base_scheme_id`
column from a string to proper integer IDs.

https://github.com/discourse/discourse/pull/34351

However, one base type called "Default" was not covered and later
conversion to an integer is failing.

<img width="973" height="56" alt="Screenshot 2025-08-20 at 12 58 04 pm"
src="https://github.com/user-attachments/assets/04b193b2-e66e-4aed-ab7c-d46605f0e802"
/>
2025-08-20 13:14:41 +08:00
Krzysztof KotlarekandOsama Sayegh a609e3421c FIX: Allow creating new color palettes based on custom palettes (#34351)
This commit:
- Changes `base_scheme_id`column from string to integer
- Migrate existing color schemes to use new type
- Modifies color palette selection to work with both base and custom
palettes
- Improves translation fallbacks for color scheme names/descriptions


https://github.com/user-attachments/assets/3d8a2fc6-50f7-42d7-840e-6e9dfb0f2474

---------

Co-authored-by: Osama Sayegh <asooomaasoooma90@gmail.com>
2025-08-20 11:58:40 +08:00
Jarek Radosz 21c3a512a2 DEV: Remove invalid options from migrations (#34384)
The change is sponsored by `Rails/AddColumnIndex` rubocop rule:

> (…) add_column does not accept index, but also does not raise an error
for extra keys, so it is possible to mistakenly add the key without
realizing it will not actually add an index.

I opted not to add these "missing" indexes since they've proven not
necessary after all.
2025-08-19 17:35:50 +02:00
Osama Sayegh 77b774e7b3 UX: Don't make seeded palettes user-selectable (#34347)
Internal topic: t/160871.
2025-08-15 08:03:55 +03:00
Alan Guo Xiang Tan 9f12dd28f9 DEV: Promote historic post_deploy migrations (#34273)
This commit promotes all post_deploy migrations which existed in
Discourse v3.4.0 (timestamp <= 20241023041126)
2025-08-13 14:10:50 +08:00
Ted Johansson 71ea236a79 FIX: Use a valid value for disabling backups using backup_frequency (#34245)
In #33558 we removed automatic_backups_enabled setting, and instead rely on backup_frequency being blank to disable.

There was a big oversight there with the site setting type system, which will coerce the value to an integer. It also makes it so you can't blank the value out in the UI.

This is a "fix forward" solution where instead of "set to blank to disable" we do "set to 0 to disable". This works along the grain of the site setting type system for a workable fix where we don't have to deal with the irreversible migration in the previous change.

We can potentially go and add in "nullable" to the type system at a later point.
2025-08-12 13:19:56 +08:00
Ted Johansson f8bf51441e DEV: Remove automatic_backups_enabled setting (#33558)
We're removing the automatic_backups_enabled toggle and depending solely on the backup_frequency value. This PR replaces the setting and adds a migration for any forum that has automatic_backups_enabled disabled.
2025-08-11 14:56:38 +08:00
Yuriy Kurant f8ac0bad72 DEV: remove experimental_sidebar_messages_count_enabled_groups (#34167)
Removes the temporary `experimental_sidebar_messages_count_enabled_groups` site setting.

Reverts #33774.
2025-08-11 12:38:50 +08:00
Martin Brennan 7121cfd4ab FEATURE: User preference for editor Markdown monospace font (#34051)
This commit responds to feedback in the Discourse Meta discussion

https://meta.discourse.org/t/monospace-font-in-the-markdown-only-editor/359936

This change introduces a user preference that allows users to choose
whether the Markdown editor uses a monospace font. The default setting
is `true` for new sites, but set to `false` for existing sites to avoid
disrupting current users' experiences.

Admins can change the `default_other_enable_markdown_monospace_font`
site setting to manage this for all users.
2025-08-04 14:56:21 +10:00
Krzysztof Kotlarek 7a9cf9356e FEATURE: Add dark color scheme setting for themes (#33967)
- Add dark_color_scheme_id to Theme model
- Update theme editor interface to allow selecting both light and dark
schemes
- Update color scheme selector to support setting default light/dark
schemes
- Fix user preferences to use theme's dark scheme instead of site
setting
<img width="1095" height="823" alt="Screenshot 2025-07-30 at 3 48 57 pm"
src="https://github.com/user-attachments/assets/cdc32e9e-b2ac-41fc-b533-047bbd09406a"
/>
<img width="1020" height="736" alt="Screenshot 2025-07-30 at 3 49 08 pm"
src="https://github.com/user-attachments/assets/63e8473f-d2a7-4fc5-81b7-4dad0d0fcace"
/>
2025-08-04 12:33:41 +08:00
Martin Brennan 6f92b20486 DEV: Drop old enable_experimental_sidebar user option (#34052)
This is no longer used anywhere in the codebase.
2025-08-04 13:48:57 +10:00
Osama Sayegh d01526f915 FEATURE: Color mode preference (#33875)
This commit adds a new dropdown preference to set the default color mode for
the user and change the color mode for the current device. It works the same way
as the interface color selector in the sidebar footer (or header), but it also allows
setting the default mode for the user that gets used when the user logs in on a
new device. It remains possible to set a color mode per device using the
sidebar/header selector or this new preference.

Internal topic: t/159358.
2025-07-31 08:17:02 +03:00
Martin Brennan 77211b43ee FEATURE: Enable rich editor for all users (#33699)
We believe the rich editor is a great experience for the
vast majority of sites and users, so we are enabling it
for all sites and all users by default.

This commit does the following:

* Hides the rich_editor site setting and sets it to true by default.
  It can still be overridden by sites that want to disable it
  completely.
* Sets `rich_editor` to true for all sites to enable the rich editor
  everywhere.
* Adds a new `default_composition_mode` site setting and corresponding
user option that defaults to Rich for all users. The other option is
Markdown.
* Changes the rich editor toggle in the composer to use the new
  database-backed user option (`composition_mode`) instead of a local
  storage key/value store. This makes the preference persistent
  across devices.

Existing key/value store settings for the markdown toggle are
kept, the preference will be saved to the user option automatically.
2025-07-28 10:08:50 +10:00
Martin Brennan 57fea290ef DEV: Use themeable site settings for Horizon (#33645)
This commit removes the value transformers introduced
to Horizon back in
https://github.com/discourse-org/nextgen-theme/commit/274e5f7a1f15e1244ce7039913036501d76ef8dc
and
https://github.com/discourse/discourse/commit/897d34132e8f323ca42dbfbd377f539761440d09
in favor of the new themeable site settings introduced in
19af83d39e , as this is what they
are for.

No migration for existing sites...they will already have
ThemeSiteSetting values from a previous migration to ensure
site setting values were preserved in theme site settings.

We do delete the ThemeField storing the Horizon custom theme
setting definition though, otherwise the UI still shows the old
settings.
2025-07-24 12:20:34 +10:00
Blake Erickson af3abb54e3 FEATURE: Add support for aws MediaConvert (#33092)
When enabled this will convert uploaded videos to a standard format that should
be playable on all devices and browsers.

The goal of this feature is to prevent codec playback issues that
sometimes can occur with video uploads.

It uses an adapter pattern, so that other services for video conversion
could be easily added in the future.
2025-07-23 11:58:33 -06:00