Enforce entropy on flag text

This commit is contained in:
Robin Ward
2013-02-08 16:55:40 -05:00
parent 1635d8e553
commit 12d3c3b66b
9 changed files with 42 additions and 32 deletions

View File

@ -25,6 +25,13 @@ class TextSentinel
end
end
def self.title_sentinel(text)
TextSentinel.new(text,
min_entropy: SiteSetting.title_min_entropy,
max_word_length: SiteSetting.max_word_length,
remove_interior_spaces: true)
end
# Entropy is a number of how many unique characters the string needs.
def entropy
return 0 if @text.blank?