summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--webapp/components/suggestion/switch_channel_provider.jsx14
1 files changed, 14 insertions, 0 deletions
diff --git a/webapp/components/suggestion/switch_channel_provider.jsx b/webapp/components/suggestion/switch_channel_provider.jsx
index 8921399ce..41ac0732a 100644
--- a/webapp/components/suggestion/switch_channel_provider.jsx
+++ b/webapp/components/suggestion/switch_channel_provider.jsx
@@ -4,6 +4,7 @@
import Suggestion from './suggestion.jsx';
import ChannelStore from 'stores/channel_store.jsx';
+import UserStore from 'stores/user_store.jsx';
import {autocompleteUsersInTeam} from 'actions/user_actions.jsx';
@@ -67,6 +68,7 @@ export default class SwitchChannelProvider {
channelPrefix,
(data) => {
const users = data.in_team;
+ const currentId = UserStore.getCurrentId();
for (const id of Object.keys(allChannels)) {
const channel = allChannels[id];
@@ -75,14 +77,21 @@ export default class SwitchChannelProvider {
}
}
+ const userMap = {};
for (let i = 0; i < users.length; i++) {
const user = users[i];
+
+ if (user.id === currentId) {
+ continue;
+ }
+
const newChannel = {
display_name: user.username,
name: user.username + ' ' + Utils.localizeMessage('channel_switch_modal.dm', '(Direct Message)'),
type: Constants.DM_CHANNEL
};
channels.push(newChannel);
+ userMap[user.id] = user;
}
channels.sort((a, b) => {
@@ -107,6 +116,11 @@ export default class SwitchChannelProvider {
items: channels,
component: SwitchChannelSuggestion
});
+
+ AppDispatcher.handleServerAction({
+ type: ActionTypes.RECEIVED_PROFILES,
+ profiles: userMap
+ });
}
);
}