FIX: use a custom prefix for custom flags (#28839)

Currently, when the custom flag has the same name as the system flag (which is disabled) then it is not displayed. To fix the problem, `custom_` prefix as `name_key` is used to distinguish between the system and the custom flag.

I considered writing a migration to fix existing custom flags name key. However, at the end of migration I would need to run rails code to reset cache `Flag.reset_flag_settings!`. I decided to skip that step as it is a very edge case. If someone has the same flag name as the system flag, then all they have to do is edit the flag and click save.

In addition, I made 2 small fixes:
- edit flag title was missing translation;
- flag form UI was not showing that description is the required field.
This commit is contained in:
Krzysztof Kotlarek
2024-09-11 15:30:20 +10:00
committed by GitHub
parent 0323b366f3
commit 1f1709d249
7 changed files with 56 additions and 23 deletions

View File

@ -791,7 +791,7 @@ RSpec.describe PostAction do
PostActionCreator.new(
Discourse.system_user,
post,
PostActionType.types[:flag_without_message],
PostActionType.types[:custom_flag_without_message],
message: "WAT",
).perform
@ -824,7 +824,7 @@ RSpec.describe PostAction do
PostActionCreator.new(
Discourse.system_user,
post,
PostActionType.types[:flag_with_message],
PostActionType.types[:custom_flag_with_message],
message: "WAT",
).perform