diff options
Diffstat (limited to 'webapp/utils')
-rw-r--r-- | webapp/utils/async_client.jsx | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/webapp/utils/async_client.jsx b/webapp/utils/async_client.jsx index 729160fe4..585e4b1c0 100644 --- a/webapp/utils/async_client.jsx +++ b/webapp/utils/async_client.jsx @@ -113,7 +113,7 @@ export function getChannel(id) { ); } -export function updateLastViewedAt(id) { +export function updateLastViewedAt(id, active) { let channelId; if (id) { channelId = id; @@ -129,9 +129,17 @@ export function updateLastViewedAt(id) { return; } + let isActive; + if (active == null) { + isActive = true; + } else { + isActive = active; + } + callTracker[`updateLastViewed${channelId}`] = utils.getTimestamp(); Client.updateLastViewedAt( channelId, + isActive, () => { callTracker[`updateLastViewed${channelId}`] = 0; ErrorStore.clearLastError(); @@ -753,6 +761,24 @@ export function getStatuses() { ); } +export function setActiveChannel(channelId) { + if (isCallInProgress(`setActiveChannel${channelId}`)) { + return; + } + + callTracker[`setActiveChannel${channelId}`] = utils.getTimestamp(); + Client.setActiveChannel( + channelId, + () => { + callTracker[`setActiveChannel${channelId}`] = 0; + }, + (err) => { + callTracker[`setActiveChannel${channelId}`] = 0; + dispatchError(err, 'setActiveChannel'); + } + ); +} + export function getMyTeam() { if (isCallInProgress('getMyTeam')) { return null; |