diff options
Diffstat (limited to 'web/react/utils/async_client.jsx')
-rw-r--r-- | web/react/utils/async_client.jsx | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx index c5957e8cc..d5fc10b8f 100644 --- a/web/react/utils/async_client.jsx +++ b/web/react/utils/async_client.jsx @@ -5,6 +5,7 @@ import * as client from './client.jsx'; import AppDispatcher from '../dispatcher/app_dispatcher.jsx'; import BrowserStore from '../stores/browser_store.jsx'; import ChannelStore from '../stores/channel_store.jsx'; +import PreferenceStore from '../stores/preference_store.jsx'; import PostStore from '../stores/post_store.jsx'; import UserStore from '../stores/user_store.jsx'; import * as utils from './utils.jsx'; @@ -17,7 +18,7 @@ var callTracker = {}; export function dispatchError(err, method) { AppDispatcher.handleServerAction({ - type: ActionTypes.RECIEVED_ERROR, + type: ActionTypes.RECEIVED_ERROR, err: err, method: method }); @@ -70,7 +71,7 @@ export function getChannels(checkVersion) { } AppDispatcher.handleServerAction({ - type: ActionTypes.RECIEVED_CHANNELS, + type: ActionTypes.RECEIVED_CHANNELS, channels: data.channels, members: data.members }); @@ -98,7 +99,7 @@ export function getChannel(id) { } AppDispatcher.handleServerAction({ - type: ActionTypes.RECIEVED_CHANNEL, + type: ActionTypes.RECEIVED_CHANNEL, channel: data.channel, member: data.member }); @@ -155,7 +156,7 @@ export function getMoreChannels(force) { } AppDispatcher.handleServerAction({ - type: ActionTypes.RECIEVED_MORE_CHANNELS, + type: ActionTypes.RECEIVED_MORE_CHANNELS, channels: data.channels, members: data.members }); @@ -194,7 +195,7 @@ export function getChannelExtraInfo(id, memberLimit) { } AppDispatcher.handleServerAction({ - type: ActionTypes.RECIEVED_CHANNEL_EXTRA_INFO, + type: ActionTypes.RECEIVED_CHANNEL_EXTRA_INFO, extra_info: data }); }, @@ -221,7 +222,7 @@ export function getProfiles() { } AppDispatcher.handleServerAction({ - type: ActionTypes.RECIEVED_PROFILES, + type: ActionTypes.RECEIVED_PROFILES, profiles: data }); }, @@ -248,7 +249,7 @@ export function getSessions() { } AppDispatcher.handleServerAction({ - type: ActionTypes.RECIEVED_SESSIONS, + type: ActionTypes.RECEIVED_SESSIONS, sessions: data }); }, @@ -275,7 +276,7 @@ export function getAudits() { } AppDispatcher.handleServerAction({ - type: ActionTypes.RECIEVED_AUDITS, + type: ActionTypes.RECEIVED_AUDITS, audits: data }); }, @@ -301,7 +302,7 @@ export function getLogs() { } AppDispatcher.handleServerAction({ - type: ActionTypes.RECIEVED_LOGS, + type: ActionTypes.RECEIVED_LOGS, logs: data }); }, @@ -327,7 +328,7 @@ export function getServerAudits() { } AppDispatcher.handleServerAction({ - type: ActionTypes.RECIEVED_SERVER_AUDITS, + type: ActionTypes.RECEIVED_SERVER_AUDITS, audits: data }); }, @@ -353,7 +354,7 @@ export function getConfig() { } AppDispatcher.handleServerAction({ - type: ActionTypes.RECIEVED_CONFIG, + type: ActionTypes.RECEIVED_CONFIG, config: data }); }, @@ -379,7 +380,7 @@ export function getAllTeams() { } AppDispatcher.handleServerAction({ - type: ActionTypes.RECIEVED_ALL_TEAMS, + type: ActionTypes.RECEIVED_ALL_TEAMS, teams: data }); }, @@ -408,7 +409,7 @@ export function findTeams(email) { } AppDispatcher.handleServerAction({ - type: ActionTypes.RECIEVED_TEAMS, + type: ActionTypes.RECEIVED_TEAMS, teams: data }); }, @@ -436,7 +437,7 @@ export function search(terms) { } AppDispatcher.handleServerAction({ - type: ActionTypes.RECIEVED_SEARCH, + type: ActionTypes.RECEIVED_SEARCH, results: data }); }, @@ -488,7 +489,7 @@ export function getPostsPage(id, maxPosts) { } AppDispatcher.handleServerAction({ - type: ActionTypes.RECIEVED_POSTS, + type: ActionTypes.RECEIVED_POSTS, id: channelId, before: true, numRequested: numPosts, @@ -538,7 +539,7 @@ export function getPosts(id) { } AppDispatcher.handleServerAction({ - type: ActionTypes.RECIEVED_POSTS, + type: ActionTypes.RECEIVED_POSTS, id: channelId, before: true, numRequested: Constants.POST_CHUNK_SIZE, @@ -577,7 +578,7 @@ export function getPostsBefore(postId, offset, numPost) { } AppDispatcher.handleServerAction({ - type: ActionTypes.RECIEVED_POSTS, + type: ActionTypes.RECEIVED_POSTS, id: channelId, before: true, numRequested: numPost, @@ -616,7 +617,7 @@ export function getPostsAfter(postId, offset, numPost) { } AppDispatcher.handleServerAction({ - type: ActionTypes.RECIEVED_POSTS, + type: ActionTypes.RECEIVED_POSTS, id: channelId, before: false, numRequested: numPost, @@ -649,7 +650,7 @@ export function getMe() { } AppDispatcher.handleServerAction({ - type: ActionTypes.RECIEVED_ME, + type: ActionTypes.RECEIVED_ME, me: data }); }, @@ -661,13 +662,12 @@ export function getMe() { } export function getStatuses() { - const directChannels = ChannelStore.getAll().filter((channel) => channel.type === Constants.DM_CHANNEL); + const preferences = PreferenceStore.getCategory(Constants.Preferences.CATEGORY_DIRECT_CHANNEL_SHOW); const teammateIds = []; - for (var i = 0; i < directChannels.length; i++) { - const teammate = utils.getDirectTeammate(directChannels[i].id); - if (teammate) { - teammateIds.push(teammate.id); + for (const preference of preferences) { + if (preference.value === 'true') { + teammateIds.push(preference.name); } } @@ -685,7 +685,7 @@ export function getStatuses() { } AppDispatcher.handleServerAction({ - type: ActionTypes.RECIEVED_STATUSES, + type: ActionTypes.RECEIVED_STATUSES, statuses: data }); }, @@ -711,7 +711,7 @@ export function getMyTeam() { } AppDispatcher.handleServerAction({ - type: ActionTypes.RECIEVED_TEAM, + type: ActionTypes.RECEIVED_TEAM, team: data }); }, @@ -737,7 +737,7 @@ export function getAllPreferences() { } AppDispatcher.handleServerAction({ - type: ActionTypes.RECIEVED_PREFERENCES, + type: ActionTypes.RECEIVED_PREFERENCES, preferences: data }); }, @@ -754,7 +754,7 @@ export function savePreferences(preferences, success, error) { (data, textStatus, xhr) => { if (xhr.status !== 304) { AppDispatcher.handleServerAction({ - type: ActionTypes.RECIEVED_PREFERENCES, + type: ActionTypes.RECEIVED_PREFERENCES, preferences }); } @@ -821,7 +821,7 @@ export function getFileInfo(filename) { callTracker[callName] = 0; AppDispatcher.handleServerAction({ - type: ActionTypes.RECIEVED_FILE_INFO, + type: ActionTypes.RECEIVED_FILE_INFO, filename, info: data }); |