about summary refs log tree commit diff
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-07-09 22:40:27 +0200
committerThibG <thib@sitedethib.com>2018-07-10 14:06:04 +0200
commitfaa4db7975c7ec2ca1bbed19047fe6900d3d5599 (patch)
tree5bf817366ff4ad024df76e6fecc556dba418e02f
parent6777dfc8d9567aa8cd23207ef44bdf38f4c17033 (diff)
[Glitch] Add option to not consider word boundaries when processing keyword filtering
Port 1ca4e51eb38de6de81cedf3ddcdaa626f1d1c569 to glitch-soc
-rw-r--r--app/javascript/flavours/glitch/selectors/index.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/selectors/index.js b/app/javascript/flavours/glitch/selectors/index.js
index 7aa7569a0..d0212c379 100644
--- a/app/javascript/flavours/glitch/selectors/index.js
+++ b/app/javascript/flavours/glitch/selectors/index.js
@@ -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 = () => {