From da461ca35d0f904fd61d5702a4b86d975e68ff38 Mon Sep 17 00:00:00 2001 From: enahum Date: Wed, 1 Nov 2017 16:26:24 -0300 Subject: [PATCH] Keep user statuses for current channel and all post visibilities (#1080) --- app/store/middleware.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/store/middleware.js b/app/store/middleware.js index 0171ccaaa..b5248b714 100644 --- a/app/store/middleware.js +++ b/app/store/middleware.js @@ -205,12 +205,26 @@ function cleanupState(action, keepCurrent = false) { } }, views: { - ...resetPayload.views + ...resetPayload.views, + channel: { + ...resetPayload.views.channel, + + // on data cleanup we need to keep the postVisibility + postVisibility: payload.views.channel.postVisibility + } } }; if (keepCurrent) { nextState.errors = payload.errors; + + // keep the statuses for users in the current channel + const profileIdsInCurrentChannel = payload.entities.users.profilesInChannel[currentChannelId]; + const nextStatuses = {}; + for (const id of profileIdsInCurrentChannel) { + nextStatuses[id] = statuses[id]; + } + nextState.entities.users.statuses = nextStatuses; } return {