diff options
Diffstat (limited to 'webapp/utils/async_client.jsx')
-rw-r--r-- | webapp/utils/async_client.jsx | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/webapp/utils/async_client.jsx b/webapp/utils/async_client.jsx index b4b361cb4..faaf3aee6 100644 --- a/webapp/utils/async_client.jsx +++ b/webapp/utils/async_client.jsx @@ -403,6 +403,36 @@ export function getProfilesInTeam(teamId = TeamStore.getCurrentId(), offset = Us ); } +export function getProfilesNotInTeam(teamId = TeamStore.getCurrentId(), offset = UserStore.getInTeamPagingOffset(), limit = Constants.PROFILE_CHUNK_SIZE) { + const callName = `getProfilesNotInTeam${teamId}${offset}${limit}`; + + if (isCallInProgress(callName)) { + return; + } + + callTracker[callName] = utils.getTimestamp(); + Client.getProfilesNotInTeam( + teamId, + offset, + limit, + (data) => { + callTracker[callName] = 0; + + AppDispatcher.handleServerAction({ + type: ActionTypes.RECEIVED_PROFILES_NOT_IN_TEAM, + profiles: data, + team_id: teamId, + offset, + count: Object.keys(data).length + }); + }, + (err) => { + callTracker[callName] = 0; + dispatchError(err, 'getProfilesNotInTeam'); + } + ); +} + export function getProfilesInChannel(channelId = ChannelStore.getCurrentId(), offset = UserStore.getInChannelPagingOffset(), limit = Constants.PROFILE_CHUNK_SIZE) { const callName = `getProfilesInChannel${channelId}${offset}${limit}`; @@ -830,34 +860,6 @@ export function getTeamMember(teamId, userId) { ); } -export function getMyTeamMembers() { - const callName = 'getMyTeamMembers'; - if (isCallInProgress(callName)) { - return; - } - - callTracker[callName] = utils.getTimestamp(); - Client.getMyTeamMembers( - (data) => { - callTracker[callName] = 0; - - const members = {}; - for (const member of data) { - members[member.team_id] = member; - } - - AppDispatcher.handleServerAction({ - type: ActionTypes.RECEIVED_MY_TEAM_MEMBERS_UNREAD, - team_members: members - }); - }, - (err) => { - callTracker[callName] = 0; - dispatchError(err, 'getMyTeamMembers'); - } - ); -} - export function getMyTeamsUnread(teamId) { const members = TeamStore.getMyTeamMembers(); if (members.length > 1) { |