mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
Enforce entropy on flag text
This commit is contained in:
parent
1635d8e553
commit
12d3c3b66b
9 changed files with 42 additions and 32 deletions
|
@ -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?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue