From 43cf9b529406a9c3df56cb46c6a0d514c7457c90 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Wed, 6 Jun 2018 13:00:53 -0400 Subject: [PATCH] Fix change team and channel in iOS share extension (#1727) --- app/store/index.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/app/store/index.js b/app/store/index.js index 7c6627b47..e47f79186 100644 --- a/app/store/index.js +++ b/app/store/index.js @@ -151,7 +151,28 @@ export default function configureAppStore(initialState) { store.subscribe(throttle(() => { const state = store.getState(); if (state.entities) { - mattermostBucket.writeToFile('entities', JSON.stringify(state.entities), Config.AppGroupId); + const channelsInTeam = {...state.entities.channels.channelsInTeam}; + Object.keys(channelsInTeam).forEach((teamId) => { + channelsInTeam[teamId] = Array.from(channelsInTeam[teamId]); + }); + + const profilesInChannel = {...state.entities.users.profilesInChannel}; + Object.keys(profilesInChannel).forEach((channelId) => { + profilesInChannel[channelId] = Array.from(profilesInChannel[channelId]); + }); + + const entities = { + ...state.entities, + channels: { + ...state.entities.channels, + channelsInTeam, + }, + users: { + ...state.entities.users, + profilesInChannel, + }, + }; + mattermostBucket.writeToFile('entities', JSON.stringify(entities), Config.AppGroupId); } }, 1000)); }