2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 10:50:21 +08:00

FIX: Make sure censored words are on boundaries in topic titles

This commit is contained in:
Robin Ward 2017-06-28 13:13:40 -04:00
parent c1560d8195
commit b93edc9945
2 changed files with 10 additions and 2 deletions

View file

@ -33,7 +33,7 @@ class CensoredWordsValidator < ActiveModel::EachValidator
def censored_words_regexp
Regexp.new(
SiteSetting.censored_words.split('|'.freeze).map! { |w| Regexp.escape(w) }.join('|'.freeze),
'\b(' + SiteSetting.censored_words.split('|'.freeze).map! { |w| Regexp.escape(w) }.join('|'.freeze) + ')\b',
true
)
end