所有包含已关注词语的帖子都会被自动隐藏 — score_to_hide_post 为 0.0

我已经仔细研究了代码,发现 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,则清楚地表明存在错误