]> cat aescling's git repositories - mastodon.git/commitdiff
[Glitch] Do not empty timeline of blocked users on block
authorThibG <thib@sitedethib.com>
Sun, 24 Mar 2019 18:15:58 +0000 (19:15 +0100)
committerThibaut Girka <thib@sitedethib.com>
Tue, 26 Mar 2019 15:07:47 +0000 (16:07 +0100)
Port 94aceb85ad638cfd02fecce1aed0be5157bcb133 to glitch-soc

app/javascript/flavours/glitch/reducers/timelines.js

index ca71c38330fa40bda17286c38c70407107adc4b6..cb233de1caf8af43b48d8674ea3cd3a2a2af12fe 100644 (file)
@@ -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;