FIX: Sensitivity did not work by default

Forums without previously calculated scores would return the same values
for low/medium/high sensitivity. Now those are scaled based on the
default value.

The default value has also been changed from 10.0 to 12.5 based on
observing data from live discourse forums.
This commit is contained in:
Robin Ward
2019-09-19 13:17:00 -04:00
parent 7ad338e3e6
commit 3c6a5836c2
3 changed files with 34 additions and 23 deletions

View File

@@ -155,6 +155,7 @@ private
def auto_hide_if_needed
return if @post.hidden?
return if !@created_by.staff? && @post.user&.staff?
return unless PostActionType.auto_action_flag_types.include?(@post_action_name)
# Special case: If you have TL3 and the user is TL0, and the flag is spam,
# hide it immediately.
@@ -163,11 +164,11 @@ private
@post.user&.trust_level == TrustLevel[0]
@post.hide!(@post_action_type_id, Post.hidden_reasons[:flagged_by_tl3_user])
return
elsif PostActionType.auto_action_flag_types.include?(@post_action_name)
score = ReviewableFlaggedPost.find_by(target: @post)&.score || 0
if score >= Reviewable.score_required_to_hide_post
@post.hide!(@post_action_type_id)
end
end
score = ReviewableFlaggedPost.find_by(target: @post)&.score || 0
if score >= Reviewable.score_required_to_hide_post
@post.hide!(@post_action_type_id)
end
end