0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-06 05:42:36 +08:00
discourse/lib/validators
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
..
allow_user_locale_enabled_validator.rb
allowed_iframes_validator.rb DEV: Replace Ruby numbered parameters by it where applicable (#37810) 2026-02-13 13:59:07 +01:00
allowed_ip_address_validator.rb
alternative_reply_by_email_addresses_validator.rb
at_least_one_group_validator.rb
categories_topics_validator.rb
category_search_priority_weights_validator.rb
censored_words_validator.rb
color_list_validator.rb
content_localization_crawler_param_validator.rb UX: Prevent incomplete crawler localization settings (#41297) 2026-07-01 12:13:22 +08:00
content_localization_locales_validator.rb
csp_script_src_validator.rb DEV: Replace Ruby numbered parameters by it where applicable (#37810) 2026-02-13 13:59:07 +01:00
css_color_validator.rb
css_color_with_blank_validator.rb
datetime_setting_validator.rb DEV: Add datetime type for site settings / object settings (#36849) 2025-12-30 10:52:30 -06:00
default_composer_category_validator.rb
delete_rejected_email_after_days_validator.rb
email_address_validator.rb
email_setting_validator.rb
email_validator.rb
emoji_picker_pinned_groups_validator.rb FEATURE: Add emoji_picker_pinned_groups for pinning groups in the picker (#41881) 2026-07-22 09:51:15 -07:00
enable_discourse_id_validator.rb FEATURE: log errors when enabling discourse id (#36110) 2025-11-25 11:20:32 +01:00
enable_local_logins_via_code_validator.rb FEATURE: Log in with a one-time email code (#40804) 2026-06-17 12:34:48 -07:00
enable_local_logins_via_email_validator.rb
enable_private_email_messages_validator.rb
enable_sso_validator.rb FIX: Reject DiscourseConnect SSO payloads when secret is blank (#40830) 2026-06-12 15:17:16 +03:00
external_system_avatars_validator.rb
form_template_yaml_validator.rb DEV: Enable Style/RedundantBegin rubocop rule (#40096) 2026-05-19 18:44:54 +02:00
google_oauth2_hd_groups_validator.rb
group_setting_validator.rb DEV: add type:group (#40981) 2026-06-17 15:07:37 +02:00
host_list_setting_validator.rb
integer_setting_validator.rb DEV: Enable Style/RedundantParentheses rubocop rule (#40095) 2026-05-19 15:48:09 +02:00
ip_address_format_validator.rb
language_switcher_setting_validator.rb
linkedin_oidc_credentials_validator.rb
markdown_linkify_tlds_validator.rb
markdown_typographer_quotation_marks_validator.rb
max_emojis_validator.rb
max_username_length_validator.rb
mediaconvert_output_subdirectory_validator.rb DEV: Update mediaconvert to use a subdirectory for output (#36049) 2025-11-20 14:03:14 -07:00
min_username_length_validator.rb
not_username_validator.rb
objects_setting_validator.rb FIX: Fix ObjectsSettingValidator error message handling (#38336) 2026-03-09 14:50:17 -03:00
password_validator.rb
pop3_polling_enabled_setting_validator.rb DEV: Fix assigned but unused variable Prism warnings (#39436) 2026-04-22 12:42:14 +02:00
post_validator.rb FIX: Cap the number of [quote] tags allowed per post (#40281) 2026-05-26 10:33:21 -03:00
quality_title_validator.rb
regex_presence_validator.rb
regex_setting_validation.rb
regex_setting_validator.rb
regexp_list_validator.rb DEV: Enable Style/RedundantBegin rubocop rule (#40096) 2026-05-19 18:44:54 +02:00
reply_by_email_address_validator.rb
reply_by_email_enabled_validator.rb
search_ranking_weights_validator.rb
search_tokenize_chinese_validator.rb
search_tokenize_japanese_validator.rb
selectable_avatars_mode_validator.rb
sso_overrides_email_validator.rb
string_setting_validator.rb DEV: Enable Style/RedundantParentheses rubocop rule (#40095) 2026-05-19 15:48:09 +02:00
stripped_length_validator.rb
timezone_validator.rb
top_menu_validator.rb FIX: Prevent empty top menu configuration (#41710) 2026-07-14 20:36:02 -03:00
topic_setting_validator.rb FEATURE: Add new configurable moderation guide (#36287) 2025-12-01 10:30:32 +08:00
topic_title_length_validator.rb
unicode_username_allowlist_validator.rb
unicode_username_validator.rb
unique_among_validator.rb FIX: Scope duplicate topic title check to what the user can see (#41871) 2026-07-24 15:35:35 +02:00
upload_setting_validator.rb DEV: clean up splash SVG on upload, not when rendering (#37681) 2026-02-16 13:14:35 +10:00
upload_validator.rb DEV: Enable Style/RedundantParentheses rubocop rule (#40095) 2026-05-19 15:48:09 +02:00
url_validator.rb
user_full_name_validator.rb
user_password_validator.rb
username_setting_validator.rb
video_conversion_enabled_validator.rb
watched_words_validator.rb