All posts containing watched words are automatically hidden — score_to_hide_post is 0.0

I’ve studied the code carefully and found that score_to_hide_post is determined by the following three methods:

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

So, in other words,
score_to_hide_post = ((high.to_f * ratio) * scale).truncate(2)

where

  • high.to_f may unexpectedly be 0 (it should normally be a positive value),
  • ratio = sensitivity / sensitivities[:low].to_f,
  • sensitivity comes from the setting (for example 3, 6, or 9),
  • sensitivities[:low] = 9,
  • scale = 1.0.

That means score_to_hide_post should never be 0, so if it becomes 0, this clearly indicates a bug.