[Glitch] Fix filters not affecting notifications in web UI

Port cfeb3beb4e to glitch-soc
This commit is contained in:
Thibaut Girka
2018-07-08 20:13:00 +02:00
committed by ThibG
parent 0bb1720495
commit 00c1386b9d
3 changed files with 18 additions and 4 deletions

View File

@ -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) => {