A platform for community discussion. Free, open, simple.
PERF: improves TextSentinel's seems_unpretentious check (#28044)
Régis Hanol73ce3589adf2
diff --git a/lib/text_sentinel.rb b/lib/text_sentinel.rbindex 7e8faff8820..9ae59fd8c87 100644--- a/lib/text_sentinel.rb+++ b/lib/text_sentinel.rb@@ -59,7 +59,7 @@ class TextSentinel# Ensure maximum word lengthdef seems_unpretentious?skipped_locales.include?(SiteSetting.default_locale) || @opts[:max_word_length].nil? ||- @text.scan(/\p{Alnum}+/).map(&:size).max.to_i <= @opts[:max_word_length]+ [email protected]?(/\p{Alnum}{#{@opts[:max_word_length] + 1},}/)end# Ensure at least one lowercase letter