From 902d9e34b4731f2654e2762e97966025b5cd7d62 Mon Sep 17 00:00:00 2001
From: unarist <m.unarist@gmail.com>
Date: Fri, 26 May 2017 23:34:08 +0900
Subject: [PATCH] Remove status context construction in the React side (#3331)

because it may causes flicker on the conversation when it contains blocked/muted user's status.

We use `/api/v1/statuses/{id}/context` to obtain status ids in the
conversation which filters blocked/muted user, but also uses internal
cache constructed from `in_reply_to_id` by `normalizeStatus()` in
`reducers/timelines.js` on each status loading which doesn't filter.

So statuses appears in conversation if those are cached, even those
statuses are from blocked/muted user. Then context cache will be updated
with the result of the context API and those statuses will be removed.

I have left the `normalizeStatus()` function itself which is called many
functions in the file as a placeholder for now, but maybe it should be
removed completely.
---
 app/javascript/mastodon/reducers/timelines.js | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/app/javascript/mastodon/reducers/timelines.js b/app/javascript/mastodon/reducers/timelines.js
index ed89f76bc..0087a06ce 100644
--- a/app/javascript/mastodon/reducers/timelines.js
+++ b/app/javascript/mastodon/reducers/timelines.js
@@ -91,19 +91,6 @@ const initialState = Immutable.Map({
 });
 
 const normalizeStatus = (state, status) => {
-  const replyToId = status.get('in_reply_to_id');
-  const id        = status.get('id');
-
-  if (replyToId) {
-    if (!state.getIn(['descendants', replyToId], Immutable.List()).includes(id)) {
-      state = state.updateIn(['descendants', replyToId], Immutable.List(), set => set.push(id));
-    }
-
-    if (!state.getIn(['ancestors', id], Immutable.List()).includes(replyToId)) {
-      state = state.updateIn(['ancestors', id], Immutable.List(), set => set.push(replyToId));
-    }
-  }
-
   return state;
 };
 
-- 
GitLab