diff options
author | Thibaut Girka <thib@sitedethib.com> | 2018-07-08 20:13:00 +0200 |
---|---|---|
committer | ThibG <thib@sitedethib.com> | 2018-07-10 14:06:04 +0200 |
commit | 00c1386b9d30d77adabb7fcb099a7f11a23ac727 (patch) | |
tree | 3eef9150fd7ee8b6a454cfbeffa56645eef27b72 /app/javascript/flavours/glitch/selectors | |
parent | 0bb1720495b1fe1eeba4a5f30f1cd03ac3469a16 (diff) |
[Glitch] Fix filters not affecting notifications in web UI
Port cfeb3beb4e1c3a05392546e6e4584de537049989 to glitch-soc
Diffstat (limited to 'app/javascript/flavours/glitch/selectors')
-rw-r--r-- | app/javascript/flavours/glitch/selectors/index.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/javascript/flavours/glitch/selectors/index.js b/app/javascript/flavours/glitch/selectors/index.js index 56eca1f02..d8dcbf8f2 100644 --- a/app/javascript/flavours/glitch/selectors/index.js +++ b/app/javascript/flavours/glitch/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) => { |