diff options
author | Corey Hulen <corey@hulen.com> | 2017-06-29 07:51:15 -0700 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2017-06-29 07:51:15 -0700 |
commit | eb7561e05bb797a0f925ac69079040016926eef5 (patch) | |
tree | de1406e5fad24b3559cd05e7e1e47c3636895b82 /webapp | |
parent | bf81fea9f8999c0b8949a9c464ef37b13ba0712b (diff) | |
download | chat-eb7561e05bb797a0f925ac69079040016926eef5.tar.gz chat-eb7561e05bb797a0f925ac69079040016926eef5.tar.bz2 chat-eb7561e05bb797a0f925ac69079040016926eef5.zip |
PLT-6610 sending websocket event for last channel viewed (#6787)
Diffstat (limited to 'webapp')
-rw-r--r-- | webapp/actions/websocket_actions.jsx | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/webapp/actions/websocket_actions.jsx b/webapp/actions/websocket_actions.jsx index 2af9a5d96..9d53ead6b 100644 --- a/webapp/actions/websocket_actions.jsx +++ b/webapp/actions/websocket_actions.jsx @@ -225,6 +225,10 @@ function handleEvent(msg) { handleAddEmoji(msg); break; + case SocketEvents.CHANNEL_VIEWED: + handleChannelViewedEvent(msg); + break; + default: } } @@ -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]); + } +} |