The discussion revolves around missing text keys for custom moderation flags in Discourse, specifically when sending messages to users whose posts are hidden or deleted due to custom flags. scharnkn initially reported that custom flag reasons like flag_reasons.mycustomflag are not defined, causing errors. Moin clarified that the issue stems from the system expecting a localized text key for custom flags, which doesn’t exist, unlike default flags. The system uses post_action_type to fetch these reasons, but custom flags lack corresponding entries in the language files. tobiaseigen acknowledged the issue and suggested using a default message format like “Your post was flagged as reason” for custom flags, and proposed adding a text key for the “illegal” flag. Moin supported this and noted the need for consistent handling of custom and illegal flag reasons. The team agreed to create new strings for both cases, such as flag_reasons.custom and responder.custom, to ensure proper display of reasons in emails and notifications. tobiaseigen also suggested simplifying the logic by using a unified message format for both default and custom flags.
I’ve been experimenting with the new “custom moderation flags” feature and I noticed that creating a new flag leads to missing text key errors in some cases.
For example when using the moderation option “Hide post”, the message send to the user expects the existence of a text key “flag_reasons.mycustomflag”.
Is it possible to add/define the missing keys? As far as I understand, the site text feature only allows to translate already present keys.
Any guidance or hints would be greatly appreciated!
We are currently in the process of having newly added strings translated for the upcoming release. Is there a particular problem you’ve experiencedwith the strings in custom flags? I’m not entirely clear based on your question. Would it be possible for you to share a screenshot?What language is it that your forum is in? Does flagging work correctly in US English?
These reasons are used when the message is created.
The code which adds this reason to the message uses the post_action_type
That works for the default flag reasons. For example, flag_reasons.spam, as seen in the screenshot above.
The problem is that there is no such string for custom flag reasons. For example, if you create a “Testing” reason and enable Auto hide flagged content.
Then flag_reasons.custom_testing is used. However, this reason does not exist. The language doesn’t matter; it does not even exist in English because it’s a custom flag.
Compared to, for example, “Your post was flagged as off-topic: the community feels it is not a good fit for the topic, as currently defined by the title and the first post,” the reason for a custom flag is only a keyword.
Maybe the “Your post was flagged as reason.” could also be used for custom flags.
for illegal, which is not a custom flag, do display the contents of topic_flag_types.illegal.description which exists. In US english, it is “This topic requires staff attention because I believe it contains content that is illegal.”
for custom flags, for clarity change reason to “The post was flagged as reason”
is there a technical limitation preventing us from including the reason description in the email?