diff options
Diffstat (limited to 'webapp/utils/async_client.jsx')
-rw-r--r-- | webapp/utils/async_client.jsx | 226 |
1 files changed, 0 insertions, 226 deletions
diff --git a/webapp/utils/async_client.jsx b/webapp/utils/async_client.jsx index abc1017fa..cb911cb55 100644 --- a/webapp/utils/async_client.jsx +++ b/webapp/utils/async_client.jsx @@ -8,7 +8,6 @@ import TeamStore from 'stores/team_store.jsx'; import ErrorStore from 'stores/error_store.jsx'; import * as GlobalActions from 'actions/global_actions.jsx'; -import {loadStatusesForProfilesMap} from 'actions/status_actions.jsx'; import AppDispatcher from 'dispatcher/app_dispatcher.jsx'; import Client from 'client/web_client.jsx'; @@ -323,231 +322,6 @@ export function getUser(userId, success, error) { ); } -export function getProfiles(offset = UserStore.getPagingOffset(), limit = Constants.PROFILE_CHUNK_SIZE) { - const callName = `getProfiles${offset}${limit}`; - - if (isCallInProgress(callName)) { - return; - } - - callTracker[callName] = utils.getTimestamp(); - Client.getProfiles( - offset, - limit, - (data) => { - callTracker[callName] = 0; - - AppDispatcher.handleServerAction({ - type: ActionTypes.RECEIVED_PROFILES, - profiles: data - }); - }, - (err) => { - callTracker[callName] = 0; - dispatchError(err, 'getProfiles'); - } - ); -} - -export function getProfilesInTeam(teamId = TeamStore.getCurrentId(), offset = UserStore.getInTeamPagingOffset(), limit = Constants.PROFILE_CHUNK_SIZE) { - const callName = `getProfilesInTeam${teamId}${offset}${limit}`; - - if (isCallInProgress(callName)) { - return; - } - - callTracker[callName] = utils.getTimestamp(); - Client.getProfilesInTeam( - teamId, - offset, - limit, - (data) => { - callTracker[callName] = 0; - - AppDispatcher.handleServerAction({ - type: ActionTypes.RECEIVED_PROFILES_IN_TEAM, - profiles: data, - team_id: teamId, - offset, - count: Object.keys(data).length - }); - }, - (err) => { - callTracker[callName] = 0; - dispatchError(err, 'getProfilesInTeam'); - } - ); -} - -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}`; - - if (isCallInProgress()) { - return; - } - - callTracker[callName] = utils.getTimestamp(); - Client.getProfilesInChannel( - channelId, - offset, - limit, - (data) => { - callTracker[callName] = 0; - - AppDispatcher.handleServerAction({ - type: ActionTypes.RECEIVED_PROFILES_IN_CHANNEL, - channel_id: channelId, - profiles: data, - offset, - count: Object.keys(data).length - }); - - loadStatusesForProfilesMap(data); - }, - (err) => { - callTracker[callName] = 0; - dispatchError(err, 'getProfilesInChannel'); - } - ); -} - -export function getProfilesNotInChannel(channelId = ChannelStore.getCurrentId(), offset = UserStore.getNotInChannelPagingOffset(), limit = Constants.PROFILE_CHUNK_SIZE) { - const callName = `getProfilesNotInChannel${channelId}${offset}${limit}`; - - if (isCallInProgress(callName)) { - return; - } - - callTracker[callName] = utils.getTimestamp(); - Client.getProfilesNotInChannel( - channelId, - offset, - limit, - (data) => { - callTracker[callName] = 0; - - AppDispatcher.handleServerAction({ - type: ActionTypes.RECEIVED_PROFILES_NOT_IN_CHANNEL, - channel_id: channelId, - profiles: data, - offset, - count: Object.keys(data).length - }); - - loadStatusesForProfilesMap(data); - }, - (err) => { - callTracker[callName] = 0; - dispatchError(err, 'getProfilesNotInChannel'); - } - ); -} - -export function getProfilesByIds(userIds) { - const callName = 'getProfilesByIds' + JSON.stringify(userIds); - - if (isCallInProgress(callName)) { - return; - } - - if (!userIds || userIds.length === 0) { - return; - } - - callTracker[callName] = utils.getTimestamp(); - Client.getProfilesByIds( - userIds, - (data) => { - callTracker[callName] = 0; - - AppDispatcher.handleServerAction({ - type: ActionTypes.RECEIVED_PROFILES, - profiles: data - }); - }, - (err) => { - callTracker[callName] = 0; - dispatchError(err, 'getProfilesByIds'); - } - ); -} - -export function getSessions() { - if (isCallInProgress('getSessions')) { - return; - } - - callTracker.getSessions = utils.getTimestamp(); - Client.getSessions( - UserStore.getCurrentId(), - (data) => { - callTracker.getSessions = 0; - - AppDispatcher.handleServerAction({ - type: ActionTypes.RECEIVED_SESSIONS, - sessions: data - }); - }, - (err) => { - callTracker.getSessions = 0; - dispatchError(err, 'getSessions'); - } - ); -} - -export function getAudits() { - if (isCallInProgress('getAudits')) { - return; - } - - callTracker.getAudits = utils.getTimestamp(); - Client.getAudits( - UserStore.getCurrentId(), - (data) => { - callTracker.getAudits = 0; - - AppDispatcher.handleServerAction({ - type: ActionTypes.RECEIVED_AUDITS, - audits: data - }); - }, - (err) => { - callTracker.getAudits = 0; - dispatchError(err, 'getAudits'); - } - ); -} - export function getLogs() { if (isCallInProgress('getLogs')) { return; |