From 92642bab6852d02e6b58f881ac909788299d0c5c Mon Sep 17 00:00:00 2001
From: Joram Wilander <jwawilander@gmail.com>
Date: Tue, 1 Nov 2016 11:13:33 -0400
Subject: Load channel members with channels to make sure we have latest unread
 counts (#4389)

---
 webapp/utils/async_client.jsx | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

(limited to 'webapp/utils/async_client.jsx')

diff --git a/webapp/utils/async_client.jsx b/webapp/utils/async_client.jsx
index c23270216..1149c565f 100644
--- a/webapp/utils/async_client.jsx
+++ b/webapp/utils/async_client.jsx
@@ -63,7 +63,7 @@ export function checkVersion() {
     }
 }
 
-export function getChannels(doVersionCheck) {
+export function getChannels() {
     if (isCallInProgress('getChannels')) {
         return null;
     }
@@ -74,10 +74,6 @@ export function getChannels(doVersionCheck) {
         (data) => {
             callTracker.getChannels = 0;
 
-            if (doVersionCheck) {
-                checkVersion();
-            }
-
             AppDispatcher.handleServerAction({
                 type: ActionTypes.RECEIVED_CHANNELS,
                 channels: data
@@ -114,7 +110,7 @@ export function getChannel(id) {
     );
 }
 
-export function getMyChannelMembers(doVersionCheck) {
+export function getMyChannelMembers() {
     if (isCallInProgress('getMyChannelMembers')) {
         return;
     }
@@ -125,10 +121,6 @@ export function getMyChannelMembers(doVersionCheck) {
         (data) => {
             callTracker.getMyChannelMembers = 0;
 
-            if (doVersionCheck) {
-                checkVersion();
-            }
-
             AppDispatcher.handleServerAction({
                 type: ActionTypes.RECEIVED_MY_CHANNEL_MEMBERS,
                 members: data
@@ -242,7 +234,7 @@ export function getMoreChannels(force) {
     }
 }
 
-export function getChannelStats(channelId = ChannelStore.getCurrentId()) {
+export function getChannelStats(channelId = ChannelStore.getCurrentId(), doVersionCheck = false) {
     if (isCallInProgress('getChannelStats' + channelId) || channelId == null) {
         return;
     }
@@ -254,6 +246,10 @@ export function getChannelStats(channelId = ChannelStore.getCurrentId()) {
         (data) => {
             callTracker['getChannelStats' + channelId] = 0;
 
+            if (doVersionCheck) {
+                checkVersion();
+            }
+
             AppDispatcher.handleServerAction({
                 type: ActionTypes.RECEIVED_CHANNEL_STATS,
                 stats: data
-- 
cgit v1.2.3-1-g7c22

