FEATURE: allow blocking emojis (#7011)

https://meta.discourse.org/t/blocking-emojis-wont-work/105853
This commit is contained in:
Arpit Jalan
2019-02-15 20:55:48 +05:30
committed by GitHub
parent a423a9383f
commit 99c6db21e6
2 changed files with 21 additions and 1 deletions

View File

@@ -19,7 +19,7 @@ class WordWatcher
nil
else
regexp = '(' + words.map { |w| word_to_regexp(w) }.join('|'.freeze) + ')'
SiteSetting.watched_words_regular_expressions? ? regexp : "\\b(#{regexp})\\b"
SiteSetting.watched_words_regular_expressions? ? regexp : "(?<!\\w)(#{regexp})(?!\\w)"
end
end
s.present? ? Regexp.new(s, Regexp::IGNORECASE) : nil