diff options
Diffstat (limited to 'webapp/actions/global_actions.jsx')
-rw-r--r-- | webapp/actions/global_actions.jsx | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/webapp/actions/global_actions.jsx b/webapp/actions/global_actions.jsx index 1dd5d6952..97d3b1071 100644 --- a/webapp/actions/global_actions.jsx +++ b/webapp/actions/global_actions.jsx @@ -36,7 +36,7 @@ import store from 'stores/redux_store.jsx'; const dispatch = store.dispatch; const getState = store.getState; import {removeUserFromTeam} from 'mattermost-redux/actions/teams'; -import {viewChannel, getChannelStats, getChannelMember} from 'mattermost-redux/actions/channels'; +import {viewChannel, getChannelStats, getMyChannelMember} from 'mattermost-redux/actions/channels'; export function emitChannelClickEvent(channel) { function userVisitedFakeChannel(chan, success, fail) { @@ -53,23 +53,22 @@ export function emitChannelClickEvent(channel) { } function switchToChannel(chan) { const channelMember = ChannelStore.getMyMember(chan.id); - const getMyChannelMemberPromise = getChannelMember(chan.id, UserStore.getCurrentId())(dispatch, getState); + const getMyChannelMemberPromise = getMyChannelMember(chan.id)(dispatch, getState); const oldChannelId = ChannelStore.getCurrentId(); getMyChannelMemberPromise.then(() => { getChannelStats(chan.id)(dispatch, getState); viewChannel(chan.id)(dispatch, getState); loadPosts(chan.id); + + // Mark previous and next channel as read + ChannelStore.resetCounts([chan.id, oldChannelId]); }); // Subtract mentions for the team const {msgs, mentions} = ChannelStore.getUnreadCounts()[chan.id] || {msgs: 0, mentions: 0}; TeamStore.subtractUnread(chan.team_id, msgs, mentions); - // Mark previous and next channel as read - ChannelStore.resetCounts(oldChannelId); - ChannelStore.resetCounts(chan.id); - BrowserStore.setGlobalItem(chan.team_id, chan.id); loadProfilesForSidebar(); |