Skip to content

Commit

Permalink
PLT-6610 sending websocket event for last channel viewed (mattermost#…
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyhulen authored and crspeller committed Jun 29, 2017
1 parent 6aff796 commit e91ccdb
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions actions/websocket_actions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ function handleEvent(msg) {
handleAddEmoji(msg);
break;

case SocketEvents.CHANNEL_VIEWED:
handleChannelViewedEvent(msg);
break;

default:
}
}
Expand Down Expand Up @@ -433,3 +437,12 @@ function handleReactionRemovedEvent(msg) {
data: reaction
});
}

function handleChannelViewedEvent(msg) {
// Useful for when multiple devices have the app open to different channels
if (ChannelStore.getCurrentId() !== msg.data.channel_id &&
UserStore.getCurrentId() === msg.broadcast.user_id) {
// Mark previous and next channel as read
ChannelStore.resetCounts([msg.data.channel_id]);
}
}

0 comments on commit e91ccdb

Please sign in to comment.