코드를 주의 깊게 검토한 결과, score_to_hide_post는 다음 세 가지 메서드에 의해 결정되는 것을 확인했습니다:
def self.sensitivity_score_value(sensitivity, scale)
return Float::MAX if sensitivity == 0
ratio = sensitivity / sensitivities[:low].to_f
high =
(PluginStore.get("reviewables", "priority_#{priorities[:high]}") || typical_sensitivity).to_f
# We want this to be hard to reach
((high.to_f * ratio) * scale).truncate(2)
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_required_to_hide_post
sensitivity_score(SiteSetting.hide_post_sensitivity)
end
즉, 다시 말해,
score_to_hide_post = ((high.to_f * ratio) * scale).truncate(2)
여기서
high.to_f는 의도치 않게 0일 수 있습니다(보통은 양의 값이어야 합니다),ratio = sensitivity / sensitivities[:low].to_f,sensitivity는 설정에서 가져온 값입니다(예: 3, 6, 또는 9),sensitivities[:low]= 9,scale = 1.0.
따라서 score_to_hide_post는 절대 0이 될 수 없으므로, 0이 된다면 이는 분명히 버그임을 의미합니다.