mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
FIX: discobot inappropriate flag section
Ensure that the inappropriate flag is used and not some other flag type. If some other flag is used a message will be posted letting the user know they used the wrong flag and the original flag will be removed so that they can try again. Bug reported on meta: https://meta.discourse.org/t/-/157075
This commit is contained in:
@ -474,7 +474,14 @@ module DiscourseNarrativeBot
|
||||
|
||||
def missing_flag
|
||||
return unless valid_topic?(@post.topic_id)
|
||||
return if @post.user_id == -2
|
||||
|
||||
# Remove any incorrect flags so that they can try again
|
||||
if @post.user_id == -2
|
||||
@post.post_actions
|
||||
.where(user_id: @user.id)
|
||||
.where("post_action_type_id IN (?)", (PostActionType.flag_types.values - [PostActionType.types[:inappropriate]]))
|
||||
.destroy_all
|
||||
end
|
||||
|
||||
fake_delay
|
||||
reply_to(@post, I18n.t("#{I18N_KEY}.flag.not_found", i18n_post_args)) unless @data[:attempted]
|
||||
|
Reference in New Issue
Block a user