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:
parent
c1560d8195
commit
b93edc9945
2 changed files with 10 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue