about summary refs log tree commit diff
path: root/app/javascript
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-07-03 21:36:15 +0200
committerClaire <claire.github-309c@sitedethib.com>2022-07-03 21:36:15 +0200
commit14185744471bfd6175a623cabdbd7b8b5be2fa59 (patch)
treed91098bdb455e0dfcae4396da1f641c671617f5c /app/javascript
parent54ed35f57c55fff639c8192b99fc60ab69c54f06 (diff)
parenta233a9bfb5f384e89bdaef6e519fa20db2a99ae5 (diff)
Merge branch 'main' into glitch-soc/merge-upstream
Diffstat (limited to 'app/javascript')
-rw-r--r--app/javascript/mastodon/components/status.js2
-rw-r--r--app/javascript/mastodon/selectors/index.js29
2 files changed, 3 insertions, 28 deletions
diff --git a/app/javascript/mastodon/components/status.js b/app/javascript/mastodon/components/status.js
index 4ca392824..238a0d734 100644
--- a/app/javascript/mastodon/components/status.js
+++ b/app/javascript/mastodon/components/status.js
@@ -338,7 +338,7 @@ class Status extends ImmutablePureComponent {
       );
     }
 
-    const matchedFilters = status.get('filtered') || status.getIn(['reblog', 'filtered']);
+    const matchedFilters = status.get('matched_filters');
     if (this.state.forceFilter === undefined ? matchedFilters : this.state.forceFilter) {
       const minHandlers = this.props.muted ? {} : {
         moveUp: this.handleHotkeyMoveUp,
diff --git a/app/javascript/mastodon/selectors/index.js b/app/javascript/mastodon/selectors/index.js
index 6aeb8b7bd..187e3306d 100644
--- a/app/javascript/mastodon/selectors/index.js
+++ b/app/javascript/mastodon/selectors/index.js
@@ -1,5 +1,5 @@
 import { createSelector } from 'reselect';
-import { List as ImmutableList, Map as ImmutableMap, is } from 'immutable';
+import { List as ImmutableList, Map as ImmutableMap } from 'immutable';
 import { me } from '../initial_state';
 
 const getAccountBase         = (state, id) => state.getIn(['accounts', id], null);
@@ -37,31 +37,6 @@ const toServerSideType = columnType => {
   }
 };
 
-const escapeRegExp = string =>
-  string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
-
-const regexFromKeywords = keywords => {
-  if (keywords.size === 0) {
-    return null;
-  }
-
-  return new RegExp(keywords.map(keyword_filter => {
-    let expr = escapeRegExp(keyword_filter.get('keyword'));
-
-    if (keyword_filter.get('whole_word')) {
-      if (/^[\w]/.test(expr)) {
-        expr = `\\b${expr}`;
-      }
-
-      if (/[\w]$/.test(expr)) {
-        expr = `${expr}\\b`;
-      }
-    }
-
-    return expr;
-  }).join('|'), 'i');
-};
-
 const getFilters = (state, { contextType }) => {
   if (!contextType) return null;
 
@@ -106,7 +81,7 @@ export const makeGetStatus = () => {
       return statusBase.withMutations(map => {
         map.set('reblog', statusReblog);
         map.set('account', accountBase);
-        map.set('filtered', filtered);
+        map.set('matched_filters', filtered);
       });
     },
   );