Browse Source

[Glitch] Add option to not consider word boundaries when processing keyword filtering

Port 1ca4e51eb3 to glitch-soc
closed-social-glitch-2
Thibaut Girka 5 years ago
committed by ThibG
parent
commit
faa4db7975
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      app/javascript/flavours/glitch/selectors/index.js

+ 4
- 1
app/javascript/flavours/glitch/selectors/index.js View File

@ -45,7 +45,10 @@ export const regexFromFilters = filters => {
return null;
}
return new RegExp(filters.map(filter => escapeRegExp(filter.get('phrase'))).map(expr => `\\b${expr}\\b`).join('|'), 'i');
return new RegExp(filters.map(filter => {
let expr = escapeRegExp(filter.get('phrase'));
return filter.get('whole_word') ? `\\b${expr}\\b` : expr;
}).join('|'), 'i');
};
export const makeGetStatus = () => {

Loading…
Cancel
Save