mirror of
https://github.com/discourse/discourse.git
synced 2026-08-06 13:08:40 +08:00
Previously, flag names with no ASCII word characters (e.g. Chinese) all normalized to the same `name_key` of `custom_`, because `set_name_key` stripped non-`\w` characters and Ruby's `\w` is ASCII-only. The flag system keys lookups by `name_key` (the `disabled_flag_types` enum, the frontend `actionByName` map), so once two flags shared a key, disabling one of them flipped `can_act` for the whole group and hid every other flag that shared it. This makes `name_key` reliably unique: - `set_name_key` falls back to `custom_flag` when the slug is empty and appends a counter (`_2`, `_3`, ...) on collision, so distinct names always produce distinct keys. It now only re-derives the key when the name actually changes, keeping it stable across other saves. - A post-deploy migration backfills existing duplicate keys and adds the unique index on `flags.name_key` that the original `create_flags` migration intended (`unique: true` is a no-op in `create_table`). https://meta.discourse.org/t/405254 |
||
|---|---|---|
| .. | ||
| 20260112082200_drop_reviewable_action_logs.rb | ||
| 20260311064518_clean_existing_tag_localization_names.rb | ||
| 20260319054730_delete_redundant_everyone_posting_review_groups.rb | ||
| 20260319054731_drop_permission_from_category_posting_review_groups.rb | ||
| 20260330161714_drop_pinned_post_number_from_nested_topics.rb | ||
| 20260422135650_strip_upload_label_escapes.rb | ||
| 20260512061336_convert_reporting_improvements_everyone_to_staff.rb | ||
| 20260601043020_rename_anonymous_auto_group_to_anonymous_users.rb | ||
| 20260602104726_recalculate_topic_counters_without_small_actions.rb | ||
| 20260603115312_remove_admin_dashboard_sections_setting.rb | ||
| 20260607161322_move_unified_new_setting_from_groups.rb | ||
| 20260624140945_ensure_unique_flag_name_keys.rb | ||