Merge pull request #860 from coralproject/suspect-hl

Highlighting suspect words working
This commit is contained in:
Kim Gardner
2017-08-18 09:35:16 +01:00
committed by GitHub
2 changed files with 9 additions and 10 deletions
@@ -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 (
<Highlighter
+4 -2
View File
@@ -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: