From ad61a63ad227b9cef68946f6c679b6cd49a01a37 Mon Sep 17 00:00:00 2001
From: Joram Wilander <jwawilander@gmail.com>
Date: Wed, 22 Feb 2017 21:32:23 -0500
Subject: Fix system admin loading members for teams not on (#5496)

---
 webapp/routes/route_team.jsx | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

(limited to 'webapp/routes/route_team.jsx')

diff --git a/webapp/routes/route_team.jsx b/webapp/routes/route_team.jsx
index b4d9e068a..f7d12f40f 100644
--- a/webapp/routes/route_team.jsx
+++ b/webapp/routes/route_team.jsx
@@ -106,12 +106,8 @@ function preNeedsTeam(nextState, replace, callback) {
     if (nextState.location.pathname.indexOf('/channels/') > -1 ||
         nextState.location.pathname.indexOf('/pl/') > -1) {
         AsyncClient.getMyTeamsUnread();
-        const teams = TeamStore.getAll();
-        for (const id in teams) {
-            if (teams.hasOwnProperty(id)) {
-                AsyncClient.getMyChannelMembersForTeam(id);
-            }
-        }
+        const members = TeamStore.getMyTeamMembers();
+        members.forEach((m) => AsyncClient.getMyChannelMembersForTeam(m.team_id));
     }
 
     const d1 = $.Deferred(); //eslint-disable-line new-cap
-- 
cgit v1.2.3-1-g7c22

