mirror of
https://git.bsd.gay/fef/nyastodon.git
synced 2024-12-26 16:03:42 +01:00
Fix glitch-soc-specific timeline filtering logic
This commit is contained in:
parent
3844f15da0
commit
2b03e21d36
1 changed files with 7 additions and 9 deletions
|
@ -4,8 +4,7 @@ import api, { getLinks } from 'flavours/glitch/util/api';
|
||||||
import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
|
import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
|
||||||
import compareId from 'flavours/glitch/util/compare_id';
|
import compareId from 'flavours/glitch/util/compare_id';
|
||||||
import { me, usePendingItems as preferPendingItems } from 'flavours/glitch/util/initial_state';
|
import { me, usePendingItems as preferPendingItems } from 'flavours/glitch/util/initial_state';
|
||||||
import { getFiltersRegex } from 'flavours/glitch/selectors';
|
import { toServerSideType } from 'flavours/glitch/util/filters';
|
||||||
import { searchTextFromRawStatus } from 'flavours/glitch/actions/importer/normalizer';
|
|
||||||
|
|
||||||
export const TIMELINE_UPDATE = 'TIMELINE_UPDATE';
|
export const TIMELINE_UPDATE = 'TIMELINE_UPDATE';
|
||||||
export const TIMELINE_DELETE = 'TIMELINE_DELETE';
|
export const TIMELINE_DELETE = 'TIMELINE_DELETE';
|
||||||
|
@ -40,14 +39,13 @@ export function updateTimeline(timeline, status, accept) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const filters = getFiltersRegex(getState(), { contextType: timeline });
|
let filtered = false;
|
||||||
const dropRegex = filters[0];
|
|
||||||
const regex = filters[1];
|
|
||||||
const text = searchTextFromRawStatus(status);
|
|
||||||
let filtered = false;
|
|
||||||
|
|
||||||
if (status.account.id !== me) {
|
if (status.filtered) {
|
||||||
filtered = (dropRegex && dropRegex.test(text)) || (regex && regex.test(text));
|
const contextType = toServerSideType(timeline);
|
||||||
|
const filters = status.filtered.filter(result => result.filter.context.includes(contextType));
|
||||||
|
|
||||||
|
filtered = filters.length > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatch(importFetchedStatus(status));
|
dispatch(importFetchedStatus(status));
|
||||||
|
|
Loading…
Reference in a new issue