summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorhmhealey <harrisonmhealey@gmail.com>2015-09-23 14:44:17 -0400
committerhmhealey <harrisonmhealey@gmail.com>2015-09-30 09:59:59 -0400
commit101068140734ebc1a310560b8719fe21dacfb277 (patch)
tree1a2510e6aecb2a795040901fe1356ec24904d327 /web
parentc4d50885a7d9c1716bc2cfe4e18a9065130bd045 (diff)
downloadchat-101068140734ebc1a310560b8719fe21dacfb277.tar.gz
chat-101068140734ebc1a310560b8719fe21dacfb277.tar.bz2
chat-101068140734ebc1a310560b8719fe21dacfb277.zip
Added channel id to updateLastViewed api calls to prevent multiple updates to different channels from clashing
Diffstat (limited to 'web')
-rw-r--r--web/react/utils/async_client.jsx16
1 files changed, 9 insertions, 7 deletions
diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx
index ab2965000..7db3ef30d 100644
--- a/web/react/utils/async_client.jsx
+++ b/web/react/utils/async_client.jsx
@@ -152,21 +152,23 @@ export function getChannel(id) {
}
export function updateLastViewedAt() {
- if (isCallInProgress('updateLastViewed')) {
+ const channelId = ChannelStore.getCurrentId();
+
+ if (channelId === null) {
return;
}
- if (ChannelStore.getCurrentId() == null) {
+ if (isCallInProgress(`updateLastViewed${channelId}`)) {
return;
}
- callTracker.updateLastViewed = utils.getTimestamp();
+ callTracker[`updateLastViewed${channelId}`] = utils.getTimestamp();
client.updateLastViewedAt(
- ChannelStore.getCurrentId(),
- function updateLastViewedAtSuccess() {
+ channelId,
+ () => {
callTracker.updateLastViewed = 0;
},
- function updateLastViewdAtFailure(err) {
+ (err) => {
callTracker.updateLastViewed = 0;
dispatchError(err, 'updateLastViewedAt');
}
@@ -634,4 +636,4 @@ export function getMyTeam() {
dispatchError(err, 'getMyTeam');
}
);
-} \ No newline at end of file
+}