0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-06 08:51:31 +08:00
discourse/lib/site_settings
Régis Hanol 3e012af58e
FIX: Scope duplicate topic title check to what the user can see (#41871)
Previously, the duplicate topic title check compared new titles against
every topic on the site regardless of visibility: users were blocked by
titles in categories they couldn't see or unlisted topics they couldn't
find, the bare "Title has already been used" error gave no way to locate
the conflict (and doubled as an existence oracle for hidden titles), and
the behavior was controlled by two entangled boolean settings.

This change scopes the check to the destination category plus whatever
the acting user can actually see, links the conflicting topic in the
error — safe by construction, since being blocked now implies being able
to see it:

> This title has already been used by [another topic]().

It also consolidates the two booleans into a single
`duplicate_topic_titles` enum (`disallowed` /
`allowed_across_categories` / `allowed`), with existing values migrated
and the old names kept as hidden deprecated aliases that admin search
still resolves.

Reported in
https://meta.discourse.org/t/title-has-already-been-used-in-a-secure-category/123047

Note for self-hosters: env-provided settings can't be migrated —
`DISCOURSE_ALLOW_DUPLICATE_TOPIC_TITLES=true` configs need to switch to
`DISCOURSE_DUPLICATE_TOPIC_TITLES=allowed`.
2026-07-24 15:35:35 +02:00
..
db_provider.rb
defaults_provider.rb DEV: Enable Style/RedundantParentheses rubocop rule (#40095) 2026-05-19 15:48:09 +02:00
dependency_graph.rb DEV: Detect circular site setting dependencies (#38165) 2026-03-04 10:10:38 +10:00
deprecated_settings.rb FIX: Scope duplicate topic title check to what the user can see (#41871) 2026-07-24 15:35:35 +02:00
hidden_provider.rb DEV: Add hide_settings metadata to upcoming changes framework (#40990) 2026-06-19 10:25:39 +04:00
label_formatter.rb FIX: Scope duplicate topic title check to what the user can see (#41871) 2026-07-24 15:35:35 +02:00
local_process_provider.rb
object_uploads_normalizer.rb FIX: type: objects uploads should be stored as IDs (#40178) 2026-05-21 13:45:27 -03:00
type_supervisor.rb UX: Link to required settings from language switcher validation error (#38374) 2026-07-16 15:51:06 -04:00
validations.rb FIX: Don't require S3 ACLs to enable secure uploads (#40596) 2026-06-05 13:56:14 +08:00
yaml_loader.rb