From 06f89cea302bc2d634044cbab6c8a5c5b369ff02 Mon Sep 17 00:00:00 2001
From: Joram Wilander <jwawilander@gmail.com>
Date: Mon, 13 Feb 2017 15:19:41 -0500
Subject: Final fixes for moving unread handling to client (#5392)

---
 webapp/utils/async_client.jsx | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

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

diff --git a/webapp/utils/async_client.jsx b/webapp/utils/async_client.jsx
index cd38be811..d47e45eb9 100644
--- a/webapp/utils/async_client.jsx
+++ b/webapp/utils/async_client.jsx
@@ -138,6 +138,35 @@ export function getMyChannelMembers() {
     });
 }
 
+export function getMyChannelMembersForTeam(teamId) {
+    return new Promise((resolve, reject) => {
+        if (isCallInProgress(`getMyChannelMembers${teamId}`)) {
+            resolve();
+            return;
+        }
+
+        callTracker[`getMyChannelMembers${teamId}`] = utils.getTimestamp();
+
+        Client.getMyChannelMembersForTeam(
+            teamId,
+            (data) => {
+                callTracker[`getMyChannelMembers${teamId}`] = 0;
+
+                AppDispatcher.handleServerAction({
+                    type: ActionTypes.RECEIVED_MY_CHANNEL_MEMBERS,
+                    members: data
+                });
+                resolve();
+            },
+            (err) => {
+                callTracker[`getMyChannelMembers${teamId}`] = 0;
+                dispatchError(err, 'getMyChannelMembersForTeam');
+                reject();
+            }
+        );
+    });
+}
+
 export function viewChannel(channelId = ChannelStore.getCurrentId(), prevChannelId = '', time = 0) {
     if (channelId == null || !Client.teamId) {
         return;
-- 
cgit v1.2.3-1-g7c22

