Commit Graph
1799 Commits
Author SHA1 Message Date
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
SamandMartin Brennan 68b901586a FEATURE: dynamic search when in /filter route (#33614)
Introduces new dynamic autocomplete for filter to make discovery
easier:

<img width="930" height="585" alt="image"
src="https://github.com/user-attachments/assets/17e7f746-a170-4f10-9ddf-77ef651e5325"
/>



https://github.com/user-attachments/assets/e9d7bc29-a593-4ef3-82a2-f10fc35ed47c

---------

Co-authored-by: Martin Brennan <martin@discourse.org>
2025-07-22 16:08:10 +10:00
David Taylor f4b70c746d DEV: Extract theme script tags into their own JS files (#33647)
Previously, all script tags in a theme field would be combined into a
single `.js` bundle along with the `text/discourse-plugin` modules. This
led to some unexpected run order, and also makes it hard to implement
the `type=module` change being developed in #33103.

This commit refactors things so that each raw script gets extracted into
its own `.js` bundle, which is then placed in exactly the same place in
the HTML.
2025-07-16 17:17:36 +01:00
Martin Brennan 19af83d39e FEATURE: Themeable site settings (#32233)
This commit introduces the concept of themeable site settings,
which is a new tool for theme authors that lives alongside theme
modifiers and theme settings. Here is a quick summary:

* Theme settings - These are custom settings used to control UI and functionality within your theme or component and provide configuration options. These cannot change core Discourse functionality.
* Theme modifiers - Allows a theme or a component to modify selected server-side functionality of core Discourse as an alternative to building a plugin.
* Themeable site settings (new) - Allows a theme (not components) to override a small subset of core site settings, which generally control parts of the UI and other minor functionality. This allows themes to have a greater control over the full site experience.

Themeable site settings will be shown for all themes, whether the theme
changes
the value or not, and have a similar UI to custom theme settings.

We are also introducing a new page at
`/admin/config/theme-site-settings` that
allows admins to see all possible themeable site settings, and which
themes
are changing the value from the default.

### Configuration

Theme authors can configure initial values themeable site settings using
a section in the `about.json` file like so:

```json
"theme_site_settings": {
  "search_experience": "search_field"
}
```

These values will not change when the theme updates, because we cannot
know if admins have manually changed them.

### Limitations

Themeable site settings are only really intended to control elements of
the UI, and when retrieving their value we require a theme ID, so these
limitations apply:

- Themeable site settings cannot be used in Sidekiq jobs
- Themeable site settings cannot be used in markdown rules
- Themeable site settings will be cached separately to client site
settings using theme ID as a key
- Themeable site settings will override keys on the `siteSettings`
service on the client using the application preloader
- `SiteSetting.client_settings_json` will not include themeable site
settings, instead you can call `SiteSetting.theme_site_settings_json`
with a theme ID

### Initial settings

There are only two site settings that will be themeable to begin with:

* `enable_welcome_banner`
* `search_experience`

And our new Horizon theme will take advantage of both. Over time, more
settings that control elements of the UI will be exposed this way.
2025-07-16 11:00:21 +10:00
Krzysztof Kotlarek d5693cd8f9 DEV: enable Foundation and stop Default (#33610)
Reveal Foundation theme and stop creating a Default for new instances.
Instead, the Foundation should be set as the default.
2025-07-15 11:16:11 +08:00
Krzysztof Kotlarek 19c3beb555 Revert "DEV: enable Foundation and stop Default" (#33599)
Reverts discourse/discourse#33508
2025-07-14 16:17:40 +08:00
Krzysztof Kotlarek 699f35aa70 DEV: enable Foundation and stop Default (#33508)
Reveal Foundation theme and stop creating a Default for new instances.
Instead, the Foundation should be set as the default.
2025-07-14 15:35:07 +08:00
Amanda Alves BranquinhoandGerhard Schlager ca36d98d55 PERF: Add indexes to improve user merger performance (#33271)
- Add indexes in some places where we were seeing bottlenecks
- Remove redundant ILIKE query

---------

Co-authored-by: Gerhard Schlager <gerhard.schlager@discourse.org>
2025-07-10 18:18:40 -03:00
Ted Johansson 3604aa2bcc DEV: Add a Gravatar enable/disable toggle (#33533)
We want to add the ability to enable/disable users selecting Gravatar for their avatar.

This change adds a site setting to enable/disable the option (default to enabled.) This will prevent users from configuring Gravatars from that point on. It does not affect already configured avatars.

We're also taking this chance to hide some of the advanced settings from the UI.
2025-07-10 15:09:32 +08:00
Ted Johansson 9f1986ec60 DEV: Remove flush_timings_secs setting (#33505)
This site setting is a internal technical detail, so we've decided to remove the setting and inline it.
2025-07-08 11:56:33 +08:00
Natalie Tay 450c6d1e98 DEV: Add limit on localized descriptions (#33492)
There are times the LLM returns values that are too large to make sense.
This adds a database limit on the column so it prevents the commit.
(https://meta.discourse.org/t/category-description-in-french-broken/372397)
2025-07-08 10:37:51 +08:00
Yuriy Kurant ba64209468 FIX: Sidebar messages link updates (#33444)
* Fixes capitalisation for *My messages*, *My posts*, and *My drafts*
sidebar links.
* Hides *My messages* link for anonymous users.
* Hides *My messages* link for users who can’t access messages.
* Adds active state for *My messages* link (applies to all child routes:
personal, group, and tags).
2025-07-07 11:55:39 +08:00
Natalie Tay 75330efab0 FIX: Prevent saving empty string as a locale (#33481)
Post edits need to inform the backend if the locale is changed and is
sometimes set as `""`. This PR prevents the locale from being set to
`""` in the database, and includes a migration to purge the empty
strings.
2025-07-04 17:20:42 +08:00
Ted Johansson 4c7089f817 DEV: Deprecate external_system_avatars_enabled (#33436)
We want to deprecate the enabled/disabled toggle for this setting and rely entirely on the presence of a URL.

This change:

- Deprecates and hides the enabled/disabled setting.
- Updates all code paths and tests that rely on the old setting.
- Adds a migration that clears the URL if the enabled/disabled setting is set to false.
2025-07-04 16:02:04 +08:00
Yuriy Kurant 30450f0449 UX: remove messages section from sidebar (#33358)
Remove the *Messages* section from the sidebar to reduce the sidebar
clutter.

Add a *My Messages* link to the top section of the sidebar.
2025-07-02 12:42:00 +08:00
Krzysztof Kotlarek 912c4f855a FEATURE: Enable system Horizon (#33374)
Enable Horizon theme for everyone.
2025-06-30 07:23:02 +08:00
Alan Guo Xiang Tan 684569c30e PERF: Avoid slow preloading in SiteSerializer (#33283)
`SiteSerializer#post_action_types` and `SiteSerializer#topic_flag_types`
both call the `Flag.used_flag_ids` method which executes queries that
becomes very slow on sites with alot of records in either the
`post_actions` or `reviewable_scores` table.

On the `post_actions` table, we execute `SELECT DISTINCT
post_action_type_id FROM post_actions`. On the `reviewable_scores`
table, we execute `SELECT DISTINCT reviewable_scope_type FROM
reviewable_scopes`. The problem with both queries is that it requires
the PG planner to scan through every single row in those tables.

For our use case, all we actually need is to check if a flag is being
referenced by a record in either the `post_actions` or
`reviewable_scores` tables. This commit updates the `Flag.used_flag_ids`
to accept a `flag_ids`
argument and use the argument to check whether the flag ids are
referenced in the `post_action_type_id` or `reviewable_scope_type`
foreign keys.
2025-06-25 15:03:34 +08:00
Natalie Tay fe30ffa3f9 DEV: Remove 'experimental' prefix from settings (#33233)
This PR takes the localization features out of "experimental" to prep
for the announcement
- rename settings and gives them its own area
- `experimental_content_localization` to `content_localization_enabled`
- `experimental_content_localization_allowed_groups` to
`content_localization_allowed_groups`
- `experimental_content_localization_supported_locales` to
`content_localization_supported_locales`
- `experimental_anon_language_switcher` to
`content_localization_anon_language_switcher`
- migration
- related to https://github.com/discourse/discourse-ai/pull/1439

| screenshot 📸 |
|---|
| <img width="964" alt="Screenshot 2025-06-17 at 5 06 32 PM"
src="https://github.com/user-attachments/assets/9a8b2c38-c846-4fc9-8ddd-815c45cc3d0e"
/> |
2025-06-19 12:23:42 +08:00
Krzysztof Kotlarek cb7d26fae5 DEV: change experimental_system_themes setting to list (#33230)
Before it was Boolean. 
The list is giving more control over which system themes should be
displayed.
2025-06-17 15:41:19 +08:00
Ted Johansson 862116a176 FEATURE: Add description to invites (#33207)
Add the ability to attach a description to an invite for easier organization.
2025-06-16 11:31:07 +08:00
Krzysztof Kotlarek 2536768a43 FEATURE: system themes (#32681)
Introduction of system themes.  System themes are local themes which:
- Cannot be deleted;
- Cannot have “custom code” added, components only;
- Cannot have uploads;
- Cannot edit color palettes;
- Are updated on deploy, like core plugins.

This PR added the Foundation system theme, which is an empty theme like
Default. The Foundation theme will be added in the next PR.

In a development environment, when system theme files are
changed/added/deleted, the theme is reuploaded and the page is reloaded
to make it a good experience for the engineer working on improvements.

System themes are not visible until
`SiteSetting.experimental_system_theme` is enabled.
2025-06-13 10:36:31 +08:00
David Battersby 34b42a9492 DEV: remove redundant composer tips site settings (#33127)
In #33012 we phased out the site settings for:

- disable_avatar_education_message
- sequential_replies_threshold
- warn_reviving_old_topic_age

This change is a follow up migration to delete the site settings from
the database.
2025-06-10 09:15:43 +04:00
Renato Atilio 232f220546 UX: add * mention to site setting description 2025-06-09 12:04:15 +08:00
David Battersby 009d835095 DEV: remove max similar results site setting (#32936)
We phased out the site setting for `max_similar_results` in #32934 -
this change is a follow up migration to delete the site setting from the
database.
2025-06-04 16:41:03 +10:00
Krzysztof Kotlarek 4e4ff41d19 FIX: latest duplicated groups to about components (#33003)
When "Add Groups to About" component is duplicated, choose the most
recently updated settings for migration.
2025-06-04 09:48:18 +08:00
Gary Pendergast 599404de31 DEV: Add a ReviewableNote model, and tie it into the Reviewable model. (#33047)
As part of the review queue refresh, we'll be adding the ability for moderators to make notes on individual reviewable items. As a first step, this change adds the new model and associated backend code.
2025-06-04 09:33:02 +10:00
Alan Guo Xiang Tan eaab4e638d DEV: Remove application code from old migration (#33007)
Application code should not be used in migrations since we want
migrations to be idempotent. Since these migrations were added 4 years
ago, the application code is safe to be removed.

This will allow me to make changes to the
`FileStore::S3Store#update_upload_ACL` without having to worry about
these migrations.
2025-06-02 09:35:15 +08:00
Natalie Tay 435088f62c DEV: Add locale column to categories (#32962)
Previously we had omitted determining the locale of categories, as
unlike posts, categories are usually single words and are usually only
translated once.

Since there is no locale, a category called "Staff" would also have an
English translation. With LLMs that perform poorly, we see that
translating "Staff" to English may result in something entirely
different (like "Personnelle" or "Personal").

Thus adding locale support to categories can mitigate this issue due to
the uncertainty.
2025-05-28 13:49:26 +08:00