mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
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:
@@ -5,5 +5,5 @@ export function createWatchedWordRegExp(word) {
|
||||
|
||||
export function toWatchedWord(regexp) {
|
||||
const [[regexpString, options]] = Object.entries(regexp);
|
||||
return { regexp: regexpString, ...options };
|
||||
return { ...options, regexp: regexpString };
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ export function setup(helper) {
|
||||
const word = toWatchedWord({ [regexpString]: options });
|
||||
|
||||
matchers.push({
|
||||
word: new RegExp(options.word, options.case_sensitive ? "" : "i"),
|
||||
word: new RegExp(options.regexp, options.case_sensitive ? "" : "i"),
|
||||
pattern: createWatchedWordRegExp(word),
|
||||
replacement: options.replacement,
|
||||
link: false,
|
||||
@@ -76,7 +76,7 @@ export function setup(helper) {
|
||||
const word = toWatchedWord({ [regexpString]: options });
|
||||
|
||||
matchers.push({
|
||||
word: new RegExp(options.word, options.case_sensitive ? "" : "i"),
|
||||
word: new RegExp(options.regexp, options.case_sensitive ? "" : "i"),
|
||||
pattern: createWatchedWordRegExp(word),
|
||||
replacement: options.replacement,
|
||||
link: true,
|
||||
|
||||
Reference in New Issue
Block a user