mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Handle all UTF-8 characters (#21344)
Watched words were converted to regular expressions containing \W, which handled only ASCII characters. Using [^[:word]] instead ensures that UTF-8 characters are also handled correctly.
This commit is contained in:
@@ -205,7 +205,7 @@ class SiteSerializer < ApplicationSerializer
|
||||
end
|
||||
|
||||
def censored_regexp
|
||||
WordWatcher.serializable_word_matcher_regexp(:censor)
|
||||
WordWatcher.serializable_word_matcher_regexp(:censor, engine: :js)
|
||||
end
|
||||
|
||||
def custom_emoji_translation
|
||||
@@ -221,11 +221,11 @@ class SiteSerializer < ApplicationSerializer
|
||||
end
|
||||
|
||||
def watched_words_replace
|
||||
WordWatcher.word_matcher_regexps(:replace)
|
||||
WordWatcher.word_matcher_regexps(:replace, engine: :js)
|
||||
end
|
||||
|
||||
def watched_words_link
|
||||
WordWatcher.word_matcher_regexps(:link)
|
||||
WordWatcher.word_matcher_regexps(:link, engine: :js)
|
||||
end
|
||||
|
||||
def categories
|
||||
|
||||
@@ -4,7 +4,7 @@ class WatchedWordSerializer < ApplicationSerializer
|
||||
attributes :id, :word, :regexp, :replacement, :action, :case_sensitive
|
||||
|
||||
def regexp
|
||||
WordWatcher.word_to_regexp(word, whole: true)
|
||||
WordWatcher.word_to_regexp(word)
|
||||
end
|
||||
|
||||
def action
|
||||
|
||||
Reference in New Issue
Block a user