Hi,
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!
2 „Gefällt mir“
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?
RGJ
(Richard - Communiteq)
1. Dezember 2024 um 17:59
4
Email sent by an US English forum, custom flag “its_hostile”
3 „Gefällt mir“
Moin
1. Dezember 2024 um 18:33
5
I don’t think the problem is related to a specific translation.
When a post is hidden because of flags from the community a personal message is sent to the author. This message contains a reason. For example:
These reasons are used when the message is created.
flag_reasons:
off_topic: "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."
inappropriate: "Your post was flagged as **inappropriate**: the community feels it is offensive, abusive, to be hateful conduct or a violation of [our community guidelines](%{base_path}/guidelines)."
illegal: "Your post was flagged as **illegal**: the community thinks it might be breaking the law."
spam: "Your post was flagged as **spam**: the community feels it is an advertisement, something that is overly promotional in nature instead of being useful or relevant to the topic as expected."
notify_moderators: "Your post was flagged **for moderator attention**: the community feels something about the post requires manual intervention by a staff member."
The code which adds this reason to the message uses the post_action_type
# inform user
if user.present?
options = {
url: url,
edit_delay: SiteSetting.cooldown_minutes_after_hiding_posts,
flag_reason:
I18n.t(
"flag_reasons.#{post_action_type_view.types[post_action_type_id]}",
locale: SiteSetting.default_locale,
base_path: Discourse.base_path,
),
}
message = custom_message
message = hiding_again ? :post_hidden_again : :post_hidden if message.nil?
Jobs.enqueue_in(
5.seconds,
:send_system_message,
user_id: user.id,
This file has been truncated. show original
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.
And the same reason is also used when the post is deleted (see screenshot in RGJ’s post)
message_options: {
flagged_post_raw_content: notify_responders ? options[:parent_post].raw : @post.raw,
flagged_post_response_raw_content: @post.raw,
url: notify_responders ? options[:parent_post].url : @post.url,
flag_reason:
I18n.t(
"flag_reasons#{".responder" if notify_responders}.#{flag_type}",
locale: SiteSetting.default_locale,
base_path: Discourse.base_path,
),
},
By the way for “responders” the illegal reason is missing too
responder:
off_topic: "The 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."
inappropriate: "The post was flagged as **inappropriate**: the community feels it is offensive, abusive, to be hateful conduct or a violation of [our community guidelines](%{base_path}/guidelines)."
spam: "The post was flagged as **spam**: the community feels it is an advertisement, something that is overly promotional in nature instead of being useful or relevant to the topic as expected."
notify_moderators: "The post was flagged **for moderator attention**: the community feels something about the post requires manual intervention by a staff member."
4 „Gefällt mir“
Thanks @scharnkn for the report and thanks @moin for following up!
Are there other places where the text key is unexpectly showing up instead of the expected text?
Hi everyone,
Thank you for providing helpful background information. I apologize for the initial lack of detail in my post.
Are there other places where the text key is unexpectly showing up instead of the expected text?
I haven’t encountered this issue elsewhere.
Best,
Katrin
Moin
4. Dezember 2024 um 12:06
9
I noticed FIX: update flag reason message with default value (#30026) · discourse/discourse@28b4ff6 · GitHub
So I tried again:
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.
And in the version for responders: “The post was flagged as reason .”
(I would also find a default text for ‘illegal’ helpful, as this is not a custom reason.)
1 „Gefällt mir“
tobiaseigen
(Tobias Eigen)
4. Dezember 2024 um 19:32
10
I’m inclined to agree with Moin…
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?
1 „Gefällt mir“
Moin
4. Dezember 2024 um 19:36
11
Tobias Eigen:
which exists
It does not. Well, the description does exist, but that is not the same as the reason. There are 3 texts:
The description shown to the user who flags the post.
The reason shown to the author of the post:
flag_reasons:
off_topic: "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."
inappropriate: "Your post was flagged as **inappropriate**: the community feels it is offensive, abusive, to be hateful conduct or a violation of [our community guidelines](%{base_path}/guidelines)."
illegal: "Your post was flagged as **illegal**: the community thinks it might be breaking the law."
spam: "Your post was flagged as **spam**: the community feels it is an advertisement, something that is overly promotional in nature instead of being useful or relevant to the topic as expected."
notify_moderators: "Your post was flagged **for moderator attention**: the community feels something about the post requires manual intervention by a staff member."
The reason shown to the responder to a deleted post when their post is also deleted and the setting is enabled. That one is missing for “illegal”:
responder:
off_topic: "The 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."
inappropriate: "The post was flagged as **inappropriate**: the community feels it is offensive, abusive, to be hateful conduct or a violation of [our community guidelines](%{base_path}/guidelines)."
spam: "The post was flagged as **spam**: the community feels it is an advertisement, something that is overly promotional in nature instead of being useful or relevant to the topic as expected."
notify_moderators: "The post was flagged **for moderator attention**: the community feels something about the post requires manual intervention by a staff member."
1 „Gefällt mir“
tobiaseigen
(Tobias Eigen)
4. Dezember 2024 um 20:17
12
Oh, interesting. (2) and (3) are nearly identical - I wonder if we are over complicating things by having different texts for these two cases.
For now, looks like we can just create a new string for illegal and make sure it works, eg
responder:
illegal: "The post was flagged as **illegal**: the community thinks it might be breaking the law."
We could also create a new string in (2) and (3) to cover all the custom flags, eg
flag_reasons:
custom: "Your post was flagged as **reason**.
responder:
custom: "The post was flagged as **reason**.
2 „Gefällt mir“