From a1cc9303352eb4055c12dc26915c30371dce6f5d Mon Sep 17 00:00:00 2001 From: ThibG Date: Sun, 24 Mar 2019 19:15:58 +0100 Subject: [PATCH] [Glitch] Do not empty timeline of blocked users on block Port 248de99443f038741f4169288d59c88cc71e73a2 to glitch-soc --- app/javascript/flavours/glitch/reducers/timelines.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/javascript/flavours/glitch/reducers/timelines.js b/app/javascript/flavours/glitch/reducers/timelines.js index ca71c38330..cb233de1ca 100644 --- a/app/javascript/flavours/glitch/reducers/timelines.js +++ b/app/javascript/flavours/glitch/reducers/timelines.js @@ -73,14 +73,15 @@ const updateTimeline = (state, timeline, status) => { })); }; -const deleteStatus = (state, id, accountId, references) => { +const deleteStatus = (state, id, accountId, references, exclude_account = null) => { state.keySeq().forEach(timeline => { - state = state.updateIn([timeline, 'items'], list => list.filterNot(item => item === id)); + if (exclude_account === null || (timeline !== `account:${exclude_account}` && !timeline.startsWith(`account:${exclude_account}:`))) + state = state.updateIn([timeline, 'items'], list => list.filterNot(item => item === id)); }); // Remove reblogs of deleted status references.forEach(ref => { - state = deleteStatus(state, ref[0], ref[1], []); + state = deleteStatus(state, ref[0], ref[1], [], exclude_account); }); return state; @@ -99,7 +100,7 @@ const filterTimelines = (state, relationship, statuses) => { } references = statuses.filter(item => item.get('reblog') === status.get('id')).map(item => [item.get('id'), item.get('account')]); - state = deleteStatus(state, status.get('id'), status.get('account'), references); + state = deleteStatus(state, status.get('id'), status.get('account'), references, relationship.id); }); return state;