diff options
author | Reverite <github@reverite.sh> | 2019-10-28 15:15:33 -0400 |
---|---|---|
committer | Reverite <github@reverite.sh> | 2019-10-28 15:15:33 -0400 |
commit | 1150110d50d9060fc325825c6770e7ef773ebcff (patch) | |
tree | 816e549592c184ffe6f545e7def2f785517be0c0 /app/javascript/flavours/glitch/actions | |
parent | 205debc43d841afaa1b2ed7dfd05a6d1b6d9d5e0 (diff) | |
parent | 00793a86bc52e4cb37318e42ea4ceb37a896c727 (diff) |
Merge branch 'glitch' into production
Diffstat (limited to 'app/javascript/flavours/glitch/actions')
-rw-r--r-- | app/javascript/flavours/glitch/actions/timelines.js | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/app/javascript/flavours/glitch/actions/timelines.js b/app/javascript/flavours/glitch/actions/timelines.js index 482762e35..097878c3b 100644 --- a/app/javascript/flavours/glitch/actions/timelines.js +++ b/app/javascript/flavours/glitch/actions/timelines.js @@ -30,12 +30,14 @@ export function updateTimeline(timeline, status, accept) { return; } - const dropRegex = getFiltersRegex(getState(), { contextType: timeline })[0]; - - if (dropRegex && status.account.id !== me) { - if (dropRegex.test(searchTextFromRawStatus(status))) { - return; - } + const filters = getFiltersRegex(getState(), { contextType: timeline }); + const dropRegex = filters[0]; + const regex = filters[1]; + const text = searchTextFromRawStatus(status); + let filtered = false; + + if (status.account.id !== me) { + filtered = (dropRegex && dropRegex.test(text)) || (regex && regex.test(text)); } dispatch(importFetchedStatus(status)); @@ -45,6 +47,7 @@ export function updateTimeline(timeline, status, accept) { timeline, status, usePendingItems: preferPendingItems, + filtered }); }; }; @@ -107,12 +110,8 @@ export function expandTimeline(timelineId, path, params = {}, done = noOp) { api(getState).get(path, { params }).then(response => { const next = getLinks(response).refs.find(link => link.rel === 'next'); - const dropRegex = getFiltersRegex(getState(), { contextType: timelineId })[0]; - - const statuses = dropRegex ? response.data.filter(status => status.account.id === me || !dropRegex.test(searchTextFromRawStatus(status))) : response.data; - - dispatch(importFetchedStatuses(statuses)); - dispatch(expandTimelineSuccess(timelineId, statuses, next ? next.uri : null, response.status === 206, isLoadingRecent, isLoadingMore, isLoadingRecent && preferPendingItems)); + dispatch(importFetchedStatuses(response.data)); + dispatch(expandTimelineSuccess(timelineId, response.data, next ? next.uri : null, response.status === 206, isLoadingRecent, isLoadingMore, isLoadingRecent && preferPendingItems)); done(); }).catch(error => { dispatch(expandTimelineFail(timelineId, error, isLoadingMore)); |