From 00787974d0a87b1a54f15cf75d2dab398546b87e Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Fri, 4 Nov 2016 12:27:19 -0400 Subject: PLT-4481 Fix member count for team user lists and channel invite list (#4422) * Fix member count for team user lists and channel invite list * Fix client unit test --- webapp/stores/user_store.jsx | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'webapp/stores') diff --git a/webapp/stores/user_store.jsx b/webapp/stores/user_store.jsx index bb3415a7d..71b98d2e5 100644 --- a/webapp/stores/user_store.jsx +++ b/webapp/stores/user_store.jsx @@ -320,6 +320,10 @@ class UserStoreClass extends EventEmitter { for (let i = 0; i < userIds.length; i++) { const profile = this.getProfile(userIds[i]); + if (!profile) { + continue; + } + if (skipCurrent && profile.id === currentId) { continue; } @@ -328,9 +332,7 @@ class UserStoreClass extends EventEmitter { continue; } - if (profile) { - profiles.push(profile); - } + profiles.push(profile); } return profiles; @@ -473,15 +475,22 @@ class UserStoreClass extends EventEmitter { userIds.splice(index, 1); } - getProfileListNotInChannel(channelId = ChannelStore.getCurrentId()) { + getProfileListNotInChannel(channelId = ChannelStore.getCurrentId(), skipInactive = false) { const userIds = this.profiles_not_in_channel[channelId] || []; const profiles = []; for (let i = 0; i < userIds.length; i++) { const profile = this.getProfile(userIds[i]); - if (profile) { - profiles.push(profile); + + if (!profile) { + continue; } + + if (skipInactive && profile.delete_at > 0) { + continue; + } + + profiles.push(profile); } return profiles; -- cgit v1.2.3-1-g7c22