From 03f39baf0d45d0ac8253a4cabdd25444be743e90 Mon Sep 17 00:00:00 2001 From: Navy Date: Thu, 10 Jun 2021 01:14:51 +0300 Subject: [PATCH] bugfix for method being added into word list --- .../client/components/settings/moderation/WordFilter.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/structure/client/components/settings/moderation/WordFilter.js b/structure/client/components/settings/moderation/WordFilter.js index 49b6ce4..584d6c5 100644 --- a/structure/client/components/settings/moderation/WordFilter.js +++ b/structure/client/components/settings/moderation/WordFilter.js @@ -77,9 +77,10 @@ module.exports = class WordFilter extends FilterSetting { } else if (['explicit', 'fuzzy', 'regex', 'whitelist'].includes(method)) { - const [first, ...rest] = args; // First arg should skip sanitisation - if (method === 'regex') args = rest.map((arg) => Util.sanitiseRegex(arg, ['?', '\\', '(', ')', '|', '\\[', '\\]', '.', '-', '<'])); - const resolved = await resolver.resolveMethod([first, ...args], { + // eslint-disable-next-line prefer-const + let [first, ...rest] = args; // First arg should skip sanitisation + if (method === 'regex') rest = rest.map((arg) => Util.sanitiseRegex(arg, ['?', '\\', '(', ')', '|', '\\[', '\\]', '.', '-', '<'])); + const resolved = await resolver.resolveMethod([first, ...rest], { existing: setting[method], allowedMethods: ['add', 'remove', 'set', 'reset', 'list'] });