mirror of
https://github.com/glitch-soc/mastodon.git
synced 2024-12-01 04:20:13 -05:00
[Glitch] Add option to not consider word boundaries when processing keyword filtering
Port 1ca4e51eb3
to glitch-soc
This commit is contained in:
parent
6777dfc8d9
commit
faa4db7975
@ -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…
Reference in New Issue
Block a user