From abb8b775b92c78cfcaf95ed1ca79fce2fe4937f3 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Thu, 17 Aug 2017 12:44:20 -0300 Subject: [PATCH 1/2] working banned and suspended words --- client/coral-admin/src/reducers/settings.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/coral-admin/src/reducers/settings.js b/client/coral-admin/src/reducers/settings.js index 6e29ba719..336047e5b 100644 --- a/client/coral-admin/src/reducers/settings.js +++ b/client/coral-admin/src/reducers/settings.js @@ -74,8 +74,10 @@ export default function settings (state = initialState, action) { }; case actions.WORDLIST_UPDATED: return update(state, { - wordList: { - [action.listName]: {$set: action.list}, + wordlist: { + [action.listName]: { + $set: action.list + } } }); case actions.DOMAINLIST_UPDATED: From ef815005a87f1a41526e0fd350daaca50bb9e3c5 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Thu, 17 Aug 2017 13:12:07 -0300 Subject: [PATCH 2/2] =?UTF-8?q?=C3=9Apdated=20suspected=20words?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/CommentBodyHighlighter.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/client/coral-admin/src/components/CommentBodyHighlighter.js b/client/coral-admin/src/components/CommentBodyHighlighter.js index 3b3ee3318..39be90d81 100644 --- a/client/coral-admin/src/components/CommentBodyHighlighter.js +++ b/client/coral-admin/src/components/CommentBodyHighlighter.js @@ -8,14 +8,11 @@ export default ({suspectWords, bannedWords, body, ...rest}) => { const links = linkify.getMatches(body); const linkText = links ? links.map((link) => link.raw) : []; - // since words are checked against word boundaries on the backend, - // should be the behavior on the front end as well. - // currently the highlighter plugin does not support out of the box. - const searchWords = [...suspectWords, ...bannedWords] - .filter((w) => { - return new RegExp(`(^|\\s)${w}(\\s|$)`, 'i').test(body); - }) - .concat(linkText); + const searchWords = [ + ...suspectWords, + ...bannedWords, + ...linkText + ]; return (