FIX: Replace watched words with wildcards (#24279)

These have been broken since fd07c943ad
because watched words were not correctly transformed to regexps.
This partially reverts the changes.
This commit is contained in:
Bianca Nenciu
2023-11-08 18:51:11 +02:00
committed by GitHub
parent e3f8e9c0fb
commit 277496b6e0
5 changed files with 26 additions and 8 deletions

View File

@@ -191,8 +191,8 @@ class TopicCreator
if watched_words.present?
word_watcher = WordWatcher.new("#{@opts[:title]} #{@opts[:raw]}")
word_watcher_tags = topic.tags.map(&:name)
watched_words.each do |word, opts|
if word_watcher.word_matches?(word, case_sensitive: opts[:case_sensitive])
watched_words.each do |_, opts|
if word_watcher.word_matches?(opts[:word], case_sensitive: opts[:case_sensitive])
word_watcher_tags += opts[:replacement].split(",")
end
end