summaryrefslogtreecommitdiffstats
path: root/web/react/utils
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2015-12-02 10:22:39 -0500
committerJoramWilander <jwawilander@gmail.com>2015-12-02 10:22:39 -0500
commit14804965b5a13f2ffef3d45c690f51d0d7ce810a (patch)
tree48d0f5f5c56287cc06fe32c7cc0885e0a4d7947c /web/react/utils
parentb8a1894b00fca1ef60f5e4607feab5db94677923 (diff)
downloadchat-14804965b5a13f2ffef3d45c690f51d0d7ce810a.tar.gz
chat-14804965b5a13f2ffef3d45c690f51d0d7ce810a.tar.bz2
chat-14804965b5a13f2ffef3d45c690f51d0d7ce810a.zip
Make proper async calls when switching channels
Diffstat (limited to 'web/react/utils')
-rw-r--r--web/react/utils/async_client.jsx22
1 files changed, 17 insertions, 5 deletions
diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx
index 8cf111d55..1b7106974 100644
--- a/web/react/utils/async_client.jsx
+++ b/web/react/utils/async_client.jsx
@@ -106,10 +106,16 @@ export function getChannel(id) {
);
}
-export function updateLastViewedAt() {
- const channelId = ChannelStore.getCurrentId();
+export function updateLastViewedAt(id) {
+ let channelId;
+ if (id) {
+ channelId = id;
+ } else {
+ channelId = ChannelStore.getCurrentId();
+ }
+ console.log('start ' + channelId);
- if (channelId === null) {
+ if (channelId == null) {
return;
}
@@ -118,6 +124,7 @@ export function updateLastViewedAt() {
}
callTracker[`updateLastViewed${channelId}`] = utils.getTimestamp();
+ console.log('call ' + channelId);
client.updateLastViewedAt(
channelId,
() => {
@@ -159,8 +166,13 @@ export function getMoreChannels(force) {
}
}
-export function getChannelExtraInfo() {
- const channelId = ChannelStore.getCurrentId();
+export function getChannelExtraInfo(id) {
+ let channelId;
+ if (id) {
+ channelId = id;
+ } else {
+ channelId = ChannelStore.getCurrentId();
+ }
if (channelId != null) {
if (isCallInProgress('getChannelExtraInfo_' + channelId)) {