Implement option to completely hide filtered toots

This commit is contained in:
Thibaut Girka 2019-07-12 18:33:55 +02:00 committed by ThibG
parent 16b79a6237
commit 42b59b730b

View file

@ -89,10 +89,11 @@ export const makeGetStatus = () => {
(state, { id }) => state.getIn(['statuses', state.getIn(['statuses', id, 'reblog'])]), (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', id, 'account'])]),
(state, { id }) => state.getIn(['accounts', state.getIn(['statuses', state.getIn(['statuses', id, 'reblog']), 'account'])]), (state, { id }) => state.getIn(['accounts', state.getIn(['statuses', state.getIn(['statuses', id, 'reblog']), 'account'])]),
(state, _) => state.getIn(['local_settings', 'filtering_behavior']),
getFiltersRegex, getFiltersRegex,
], ],
(statusBase, statusReblog, accountBase, accountReblog, filtersRegex) => { (statusBase, statusReblog, accountBase, accountReblog, filteringBehavior, filtersRegex) => {
if (!statusBase) { if (!statusBase) {
return null; return null;
} }
@ -116,6 +117,10 @@ export const makeGetStatus = () => {
filtered = filtered || regex && regex.test(statusBase.get('search_index')); filtered = filtered || regex && regex.test(statusBase.get('search_index'));
if (filtered && filteringBehavior === 'drop') {
return null;
}
return statusBase.withMutations(map => { return statusBase.withMutations(map => {
map.set('reblog', statusReblog); map.set('reblog', statusReblog);
map.set('account', accountBase); map.set('account', accountBase);