DEV: Refactor watched words (#24163)

- Ignore only invalid words, not all words if one of them is invalid

- The naming scheme for methods was inconsistent

- Optimize regular expressions
This commit is contained in:
Bianca Nenciu
2023-11-01 16:41:10 +02:00
committed by GitHub
parent a32fce9e1d
commit fd07c943ad
12 changed files with 170 additions and 155 deletions

View File

@ -210,7 +210,7 @@ class SiteSerializer < ApplicationSerializer
end
def censored_regexp
WordWatcher.serializable_word_matcher_regexp(:censor, engine: :js)
WordWatcher.serialized_regexps_for_action(:censor, engine: :js)
end
def custom_emoji_translation
@ -226,11 +226,11 @@ class SiteSerializer < ApplicationSerializer
end
def watched_words_replace
WordWatcher.word_matcher_regexps(:replace, engine: :js)
WordWatcher.regexps_for_action(:replace, engine: :js)
end
def watched_words_link
WordWatcher.word_matcher_regexps(:link, engine: :js)
WordWatcher.regexps_for_action(:link, engine: :js)
end
def categories