Commit Graph
1837 Commits
Author SHA1 Message Date
Martin Brennan 6e8570b0fb DEV: Rename experimental_ upcoming change settings (#37589)
We can use the status of upcoming changes to indicate
whether they are experimental or not, having experimental
in the setting name is redundant.

Migrates the settings and the upcoming change events,
updates code, and updates yaml translation keys.
2026-02-10 10:34:37 +10:00
Alan Guo Xiang Tan c48f18dbed FIX: Resolve tag synonyms in search and filter queries (#37628)
What is the problem?

Discourse allows admins to mark a tag as a synonym of another tag. For
example, "brunch" can be made a synonym of "lunch". When this happens,
all topics tagged with "brunch" are automatically retagged with "lunch",
and the `tags.target_tag_id` column on the synonym tag record is set to
point to the target tag.

However, several code paths did not account for synonyms:

1. **Search:** `Search#search_tags` and the hashtag advanced filter did
   not resolve synonyms. When a user searched using a synonym name (e.g.
   `tags:brunch`, `tags:brunch+eggs`, or `#brunch`), no results were
   returned because:
   - The `tags:` comma path queries `topic_tags` joined with `tags` by
     name, but topics are tagged with the target tag "lunch", not the
     synonym "brunch".
   - The `tags:` plus path aggregates tag names per topic into a
     tsvector and matches against the searched name, but the aggregated
     names are target tag names, so "brunch" never matches.
   - The `#` hashtag path picks the synonym tag's own `id` and queries
     `topic_tags` by that ID, but topics store the target tag's ID.

2. **Filter route:** `TopicsFilter#tag_ids_from_tag_names` concatenated
   both the synonym's own ID and the target tag ID. For match-all
   queries (e.g. `tag:brunch`), this required a topic to have both IDs
   in `topic_tags`, which never happens since only the target tag ID is
   stored. For negation queries (e.g. `-tag:brunch`), the exclusion
   targeted the synonym ID rather than the target, so no topics were
   excluded.

What is the solution?

In `Search#search_tags`, add a synonym resolution step before the
existing comma/plus branching logic. It splits the match string into
individual tag names, queries for any that are synonyms via
`Tag.where_name(tag_names).where.not(target_tag_id: nil)`, builds a
name mapping, and replaces synonym names with their target tag names.
The replacement operates on the split array elements rather than using
substring replacement to avoid corrupting tag names that may contain
other tag names as substrings.

In the hashtag advanced filter, pick both `:id` and `:target_tag_id`
from the tag lookup and prefer `target_tag_id` when present, so the
query uses the target tag's ID instead of the synonym's own ID.

In `TopicsFilter#tag_ids_from_tag_names`, replace the transpose/concat
approach with `.map { |id, target_id| target_id || id }` to resolve
each tag to its canonical ID — the target for synonyms, or the tag's
own ID otherwise.

A partial index on `tags.target_tag_id` is added (scoped to
`WHERE target_tag_id IS NOT NULL`) to support efficient synonym lookups.
2026-02-09 15:57:52 +08:00
Sam a1c2ac845d DEV: fix a large amount of typos (#37428) 2026-02-02 16:31:58 +11:00
Sam 6c0afb4a54 FIX: Exclude unlisted topics from hot scores (#37312)
Unlisted topics (visible=false) should not appear in hot topic
rankings. This change:

- Filters out unlisted topics when updating hot scores
- Excludes unlisted topics from hottest_topic_ids cache
- Applies 50% score reduction to closed topics
- Removes unlisted topics from index
2026-01-27 13:46:57 +11:00
fb9bb31983 FEATURE: Notify admins of upcoming changes and log events (#37003)
This commit adds several pieces of functionality to help keep admins
in the loop about upcoming changes.

First of all, there is a new initializer on boot that will notify admins
about
newly available upcoming changes, as well as log removed changes and
status movement of existing changes.

* When there is a new upcoming change, we only notify admins about
   it when the status is the `promote_upcoming_changes_on_status` - 1,
   e.g. if `promote_upcoming_changes_on_status` is `beta` then we only
   tell admin about the change once it has reached `alpha`. This means
   we may log the `added` event in one deploy, but only actually notify
   admins in a subsequent deploy.
* We log removed upcoming changes so we can automatically delete old
   site setting data in a future job as needed.

We also now  notify  admins when  upcoming changes are automatically
promoted to enabled based on the site's
`promote_upcoming_changes_on_status`:

<img width="378" height="600" alt="image"
src="https://github.com/user-attachments/assets/4200fbee-9990-4bbc-a378-85946e631e77"
/>

In addition, we now show an indicator in the admin sidebar
if there are new upcoming changes that have been added since
they last visited the upcoming change config page. This data
is stored in a user custom field, because Redis is ephemeral,
and storing in the User table is overkill because 99% of users
are not staff:

<img width="248" height="112" alt="image"
src="https://github.com/user-attachments/assets/4c3d3cf7-ac39-45f8-a2c8-a049cb85b8e9"
/>

Finally, this commit moves both the Track and Promote initializer
logic behind a `DistributedMutex`, we don't want multiple processes
running the same logic here, it needs to be only once.

---------

Co-authored-by: Loïc Guitaut <loic@discourse.org>
Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2026-01-21 12:45:54 +10:00
Jarek RadoszandLoïc Guitaut 61b723a73f DEV: Remove the obsolete sidekiq patch (#37145)
Co-authored-by: Loïc Guitaut <loic@discourse.org>
2026-01-19 16:00:06 +01:00
Alan Guo Xiang Tan 24d4fc4825 PERF: Drop unused indexes on top_topics table (#37053)
The top_topics table had 20 indexes on count columns (daily_posts_count,
daily_views_count, etc.) that were never used according to
pg_stat_user_indexes. Only the *_score indexes are queried for /top
pages.
2026-01-12 12:55:28 +08:00
Martin BrennanandRégis Hanol d2252b5cd3 DEV: Remove IMAP support in Discourse (#37002)
per
https://meta.discourse.org/t/imap-support-for-group-inboxes/160588/39?u=martin
we have been planning to remove IMAP support for a while,
because of its low usage and adoption, high complexity, and maintenance
burden.
This commit removes all IMAP-related code, including models,
jobs, services, and frontend components.

---------

Co-authored-by: Régis Hanol <regis@hanol.fr>
2026-01-12 10:07:26 +10:00
Alan Guo Xiang Tan 42a94eb6a5 PERF: Add index_topics_on_category_id (#37022)
Joining the `topics` table against the `categories` table is a common
thing we do and the missing index on the `category_id` foreign key is
hurting performance on sites with lots of rows in the `topics` and
`categories` tables.
2026-01-09 13:07:30 +08:00
Natalie Tay d1740ab499 DEV: Add slugs to tag model (#36985)
We're adding `slug` to the `Tag` model so that we can move URLs away
from the `/tag/name` convention to `/tag/slug/id`.

This commit only includes adding the column in the database, a migration,
and ActiveRecord validation. For extra info to the reviewer, this is a
list of scenarios for how slugs are generated in categories, in the tag
migration, and tag model:

| scenario | category | tag (migration) | tag (model) |

|-----------------------------------|------------------|------------------|------------------|
| normal ("Turkish Angora") | "turkish-angora" | "turkish-angora" |
"turkish-angora" |
| numeric-only ("123") | "" | "" | "" |
| unicode-only ("猫") | "" | "" | "" |
| unicode mixed ("turkish猫angora") | "turkish-angora" | "turkish-angora"
| "turkish-angora" |
| special chars ("turkish@angora!") | "turkish-angora" |
"turkish-angora" | "turkish-angora" |
| special chars only ("@#$%") | "" | "" | "" |
| conflict | "" | "" | "" |

All empty slugs use slug_for_url → "#{id}-tag" for URLs. This is similar
to how categories work to keep consistent. This PR contains 2
migrations, slug generation and index creation. The migration spec
doesn't allow for "CONCURRENT" index creation, so we are separating them
to make things easier to test.
2026-01-08 11:03:01 +08:00
Régis Hanol ae58a5a1be FIX: Dismissing admin notices fails with 422 when tracker has NULL target (#36878)
When dismissing an admin notice, the service would look up the
associated `ProblemCheckTracker` by identifier only. This could find a
tracker with a `NULL` target, which then fails validation on update
since target is now required (as of 8ca5fb706a).

The root issue is that `problem_check_trackers.target` was added with
`null: true` and while we later added a default value of `"__NULL__"`
and a Ruby validation, we never enforced `NOT NULL` at the database
level. This allowed records with `NULL` targets to persist or be
recreated through code paths that explicitly passed nil.

This commit:

- Updates the dismiss service to look up trackers by both identifier AND
target (extracted from the admin notice's details)
- Removes any remaining records with `NULL` targets
- Adds a `NOT NULL` constraint to prevent this from recurring

Ref - https://meta.discourse.org/t/392248
2025-12-29 16:32:12 +01:00
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