From ced5f54500b2688a942c5c1afbb4fca3882b4f51 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Fri, 11 Nov 2016 14:55:05 -0500 Subject: Fixing new messages indicator (#4531) --- webapp/actions/global_actions.jsx | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'webapp/actions') diff --git a/webapp/actions/global_actions.jsx b/webapp/actions/global_actions.jsx index 6a63b5630..f7c4c455c 100644 --- a/webapp/actions/global_actions.jsx +++ b/webapp/actions/global_actions.jsx @@ -43,16 +43,20 @@ export function emitChannelClickEvent(channel) { ); } function switchToChannel(chan) { - AsyncClient.getChannelStats(chan.id, true); - AsyncClient.updateLastViewedAt(chan.id); - loadPosts(chan.id); - trackPage(); - - AppDispatcher.handleViewAction({ - type: ActionTypes.CLICK_CHANNEL, - name: chan.name, - id: chan.id, - prev: ChannelStore.getCurrentId() + const getMyChannelMembersPromise = AsyncClient.getChannelMember(chan.id, UserStore.getCurrentId()); + + getMyChannelMembersPromise.then(() => { + AsyncClient.getChannelStats(chan.id, true); + AsyncClient.updateLastViewedAt(chan.id); + loadPosts(chan.id); + trackPage(); + + AppDispatcher.handleViewAction({ + type: ActionTypes.CLICK_CHANNEL, + name: chan.name, + id: chan.id, + prev: ChannelStore.getCurrentId() + }); }); } -- cgit v1.2.3-1-g7c22