FIX: Make serialized watched word regex Javascript compatible (#22010)

This change ensures Javascript compatible regex is serialized instead of
the default ruby based one.
This commit is contained in:
Selase Krakani
2023-06-09 10:22:41 +00:00
committed by GitHub
parent 9c926ce645
commit b3bb3872cf
3 changed files with 56 additions and 2 deletions

View File

@ -18,7 +18,7 @@ class WatchedWordListSerializer < ApplicationSerializer
def compiled_regular_expressions
expressions = {}
actions.each do |action|
expressions[action] = WordWatcher.serializable_word_matcher_regexp(action)
expressions[action] = WordWatcher.serializable_word_matcher_regexp(action, engine: :js)
end
expressions
end

View File

@ -4,7 +4,7 @@ class WatchedWordSerializer < ApplicationSerializer
attributes :id, :word, :regexp, :replacement, :action, :case_sensitive
def regexp
WordWatcher.word_to_regexp(word)
WordWatcher.word_to_regexp(word, engine: :js)
end
def action