about summary refs log tree commit diff
path: root/app/javascript/mastodon/selectors
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-07-07 19:31:19 +0200
committerGitHub <noreply@github.com>2018-07-07 19:31:19 +0200
commitcfeb3beb4e1c3a05392546e6e4584de537049989 (patch)
tree2af0c147474be3cca1af704393835607d4bb141f /app/javascript/mastodon/selectors
parentcd509d2146439490bcb63081739db1d5fd485d56 (diff)
Fix filters not affecting notifications in web UI (#7977)
* Hook up filtering to statuses in notifications column

* Filter notifications for sound, desktop notifications
Diffstat (limited to 'app/javascript/mastodon/selectors')
-rw-r--r--app/javascript/mastodon/selectors/index.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/app/javascript/mastodon/selectors/index.js b/app/javascript/mastodon/selectors/index.js
index ba9777eba..7aa7569a0 100644
--- a/app/javascript/mastodon/selectors/index.js
+++ b/app/javascript/mastodon/selectors/index.js
@@ -35,10 +35,12 @@ const toServerSideType = columnType => {
   }
 };
 
+export const getFilters = (state, { contextType }) => state.get('filters', ImmutableList()).filter(filter => contextType && filter.get('context').includes(toServerSideType(contextType)) && (filter.get('expires_at') === null || Date.parse(filter.get('expires_at')) > (new Date())));
+
 const escapeRegExp = string =>
   string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
 
-const regexFromFilters = filters => {
+export const regexFromFilters = filters => {
   if (filters.size === 0) {
     return null;
   }
@@ -53,7 +55,7 @@ export const makeGetStatus = () => {
       (state, { id }) => state.getIn(['statuses', state.getIn(['statuses', id, 'reblog'])]),
       (state, { id }) => state.getIn(['accounts', state.getIn(['statuses', id, 'account'])]),
       (state, { id }) => state.getIn(['accounts', state.getIn(['statuses', state.getIn(['statuses', id, 'reblog']), 'account'])]),
-      (state, { contextType }) => state.get('filters', ImmutableList()).filter(filter => contextType && filter.get('context').includes(toServerSideType(contextType)) && (filter.get('expires_at') === null || Date.parse(filter.get('expires_at')) > (new Date()))),
+      getFilters,
     ],
 
     (statusBase, statusReblog, accountBase, accountReblog, filters) => {