From 14804965b5a13f2ffef3d45c690f51d0d7ce810a Mon Sep 17 00:00:00 2001
From: JoramWilander <jwawilander@gmail.com>
Date: Wed, 2 Dec 2015 10:22:39 -0500
Subject: Make proper async calls when switching channels

---
 web/react/utils/async_client.jsx | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

(limited to 'web/react/utils/async_client.jsx')

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)) {
-- 
cgit v1.2.3-1-g7c22


From 9adcbe58fe4f39ab9da50f283f8003f416b8fb4d Mon Sep 17 00:00:00 2001
From: JoramWilander <jwawilander@gmail.com>
Date: Wed, 2 Dec 2015 10:35:17 -0500
Subject: Remove logging

---
 web/react/utils/async_client.jsx | 2 --
 1 file changed, 2 deletions(-)

(limited to 'web/react/utils/async_client.jsx')

diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx
index 1b7106974..5df43b548 100644
--- a/web/react/utils/async_client.jsx
+++ b/web/react/utils/async_client.jsx
@@ -113,7 +113,6 @@ export function updateLastViewedAt(id) {
     } else {
         channelId = ChannelStore.getCurrentId();
     }
-    console.log('start ' + channelId);
 
     if (channelId == null) {
         return;
@@ -124,7 +123,6 @@ export function updateLastViewedAt(id) {
     }
 
     callTracker[`updateLastViewed${channelId}`] = utils.getTimestamp();
-    console.log('call ' + channelId);
     client.updateLastViewedAt(
         channelId,
         () => {
-- 
cgit v1.2.3-1-g7c22

