FIX: Don't hide/close topics if they don't meet minimum visibility

There are situations where depending on site settings, actions could be
taken due to flags (for example, hiding a post) but those actions were
not visibile in the review queue due to visibility settings.

This patch makes sure that the minimum score required for an action such
as hiding a post needs to meet the visibility for a moderator to see it.
This commit is contained in:
Robin Ward
2019-08-06 15:34:39 -04:00
parent 44ad8ee39b
commit f1b3e72581
2 changed files with 16 additions and 1 deletions

View File

@@ -188,7 +188,7 @@ class Reviewable < ActiveRecord::Base
end
end
def self.sensitivity_score(sensitivity, scale: 1.0)
def self.sensitivity_score_value(sensitivity, scale)
return Float::MAX if sensitivity == 0
ratio = sensitivity / Reviewable.sensitivity[:low].to_f
@@ -199,6 +199,13 @@ class Reviewable < ActiveRecord::Base
(high.to_f * ratio) * scale
end
def self.sensitivity_score(sensitivity, scale: 1.0)
# If the score is less than the default visibility, bring it up to that level.
# Otherwise we have the confusing situation where a post might be hidden and
# moderators would never see it!
[sensitivity_score_value(sensitivity, scale), min_score_for_priority].max
end
def self.score_to_auto_close_topic
sensitivity_score(SiteSetting.auto_close_topic_sensitivity, scale: 2.5)
end