FIX: Alter "Take Action" default behaviour to hide post (#24088)

This commit fixes an issue where clicking the default
"Take Action" option on a flag for a post doesn't always
end up with the post hidden.

This is because the "take_action" score bonus doesn’t take into account
the final score required to hide the post.

Especially with the `hide_post_sensitivity` site setting set to `low`
sensitivity, there is a likelihood the score needed to hide the post
won’t be reached.

Now, the default "Take Action" button has been changed to "Hide Post"
to reflect what is actually happening and the description has been
improved, and if "Take Action" is clicked we _always_ hide the post
regardless of score and sensitivity settings. This way the action reflects
expectations of the user.
This commit is contained in:
Martin Brennan
2023-10-30 10:24:35 +10:00
committed by GitHub
parent c0dff8e728
commit 0a4b1b655d
10 changed files with 118 additions and 21 deletions

View File

@ -250,7 +250,9 @@ class PostActionCreator
end
score = ReviewableFlaggedPost.find_by(target: @post)&.score || 0
@post.hide!(@post_action_type_id) if score >= Reviewable.score_required_to_hide_post
if score >= Reviewable.score_required_to_hide_post || @take_action
@post.hide!(@post_action_type_id)
end
end
# Special case: If you have TL3 and the user is TL0, and the flag is spam,