mirror of
https://github.com/discourse/discourse.git
synced 2026-08-05 10:47:46 -05:00
FIX: Make replace watched words work with wildcard (#13084)
Watched words are always regular expressions, despite watched_words_ _regular_expressions being enabled or not. Internally, wildcard characters are replaced with a regular expression that matches any non whitespace character.
This commit is contained in:
@@ -51,6 +51,12 @@ class WordWatcher
|
||||
nil # Admin will be alerted via admin_dashboard_data.rb
|
||||
end
|
||||
|
||||
def self.word_matcher_regexps(action)
|
||||
if words = get_cached_words(action)
|
||||
words.map { |w, r| [word_to_regexp(w), r] }.to_h
|
||||
end
|
||||
end
|
||||
|
||||
def self.word_to_regexp(word)
|
||||
if SiteSetting.watched_words_regular_expressions?
|
||||
# Strip ruby regexp format if present, we're going to make the whole thing
|
||||
|
||||
Reference in New Issue
Block a user