From ba6e370ca71abacaa30234cb164427d27c86df13 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Wed, 21 Dec 2016 16:35:01 -0500 Subject: PLT-5012 Combine updateLastViewedAt, setLastViewedAt and setActiveChannel into a single API (#4840) * Combine updateLastViewedAt, setLastViewedAt and setActiveChannel into a single API * Remove preference DB writes --- webapp/actions/channel_actions.jsx | 2 +- webapp/actions/global_actions.jsx | 2 +- webapp/actions/post_actions.jsx | 2 +- webapp/actions/websocket_actions.jsx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'webapp/actions') diff --git a/webapp/actions/channel_actions.jsx b/webapp/actions/channel_actions.jsx index ad2f315ee..952c8ada3 100644 --- a/webapp/actions/channel_actions.jsx +++ b/webapp/actions/channel_actions.jsx @@ -53,7 +53,7 @@ export function executeCommand(message, args, success, error) { export function setChannelAsRead(channelIdParam) { const channelId = channelIdParam || ChannelStore.getCurrentId(); - AsyncClient.updateLastViewedAt(); + AsyncClient.viewChannel(); ChannelStore.resetCounts(channelId); ChannelStore.emitChange(); if (channelId === ChannelStore.getCurrentId()) { diff --git a/webapp/actions/global_actions.jsx b/webapp/actions/global_actions.jsx index 9d135dd26..e1009e9c2 100644 --- a/webapp/actions/global_actions.jsx +++ b/webapp/actions/global_actions.jsx @@ -48,7 +48,7 @@ export function emitChannelClickEvent(channel) { getMyChannelMembersPromise.then(() => { AsyncClient.getChannelStats(chan.id, true); - AsyncClient.updateLastViewedAt(chan.id); + AsyncClient.viewChannel(chan.id, ChannelStore.getCurrentId()); loadPosts(chan.id); trackPage(); }); diff --git a/webapp/actions/post_actions.jsx b/webapp/actions/post_actions.jsx index d1e69cda7..71b9e826e 100644 --- a/webapp/actions/post_actions.jsx +++ b/webapp/actions/post_actions.jsx @@ -22,7 +22,7 @@ export function handleNewPost(post, msg) { if (ChannelStore.getCurrentId() === post.channel_id) { if (window.isActive) { - AsyncClient.updateLastViewedAt(null, false); + AsyncClient.viewChannel(); } else { AsyncClient.getChannel(post.channel_id); } diff --git a/webapp/actions/websocket_actions.jsx b/webapp/actions/websocket_actions.jsx index 6c81a4ac9..f24802003 100644 --- a/webapp/actions/websocket_actions.jsx +++ b/webapp/actions/websocket_actions.jsx @@ -205,7 +205,7 @@ function handlePostEditEvent(msg) { // Update channel state if (ChannelStore.getCurrentId() === msg.broadcast.channel_id) { if (window.isActive) { - AsyncClient.updateLastViewedAt(null, false); + AsyncClient.viewChannel(); } } } -- cgit v1.2.3-1-g7c22