Modify/add site text associated with custom moderation flags?

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 Likes

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?

Email sent by an US English forum, custom flag “its_hostile”

3 Likes

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.

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.

And the same reason is also used when the post is deleted (see screenshot in RGJ’s post)

By the way for “responders” the illegal reason is missing too

4 Likes

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

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 Like

I’m inclined to agree with Moin…

  1. 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.”
  2. 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 Like

It does not. Well, the description does exist, but that is not the same as the reason. There are 3 texts:

  1. The description shown to the user who flags the post.

  2. The reason shown to the author of the post:

  1. 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”:
1 Like

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 Likes