diff options
Diffstat (limited to 'webapp/utils')
-rw-r--r-- | webapp/utils/async_client.jsx | 22 | ||||
-rw-r--r-- | webapp/utils/constants.jsx | 1 | ||||
-rw-r--r-- | webapp/utils/utils.jsx | 7 |
3 files changed, 30 insertions, 0 deletions
diff --git a/webapp/utils/async_client.jsx b/webapp/utils/async_client.jsx index 189b159e8..0dede3bc9 100644 --- a/webapp/utils/async_client.jsx +++ b/webapp/utils/async_client.jsx @@ -224,6 +224,28 @@ export function getTeamMembers(teamId) { ); } +export function getProfilesForDirectMessageList() { + if (isCallInProgress('getProfilesForDirectMessageList')) { + return; + } + + callTracker.getProfilesForDirectMessageList = utils.getTimestamp(); + Client.getProfilesForDirectMessageList( + (data) => { + callTracker.getProfilesForDirectMessageList = 0; + + AppDispatcher.handleServerAction({ + type: ActionTypes.RECEIVED_PROFILES_FOR_DM_LIST, + profiles: data + }); + }, + (err) => { + callTracker.getProfilesForDirectMessageList = 0; + dispatchError(err, 'getProfilesForDirectMessageList'); + } + ); +} + export function getProfiles() { if (isCallInProgress('getProfiles')) { return; diff --git a/webapp/utils/constants.jsx b/webapp/utils/constants.jsx index 88bf56706..3ae99d7fa 100644 --- a/webapp/utils/constants.jsx +++ b/webapp/utils/constants.jsx @@ -60,6 +60,7 @@ export default { RECEIVED_MENTION_DATA: null, RECEIVED_ADD_MENTION: null, + RECEIVED_PROFILES_FOR_DM_LIST: null, RECEIVED_PROFILES: null, RECEIVED_DIRECT_PROFILES: null, RECEIVED_ME: null, diff --git a/webapp/utils/utils.jsx b/webapp/utils/utils.jsx index 8917c97e4..e34fa403f 100644 --- a/webapp/utils/utils.jsx +++ b/webapp/utils/utils.jsx @@ -1247,6 +1247,13 @@ export function openDirectChannelToUser(user, successCb, errorCb) { 'true' ); + // if the user in another team and isn't already in the direct message + // list then we should add him so his name shows up correctly. + var profileUser = UserStore.getProfile(user.id); + if (!profileUser) { + UserStore.getDirectProfiles()[user.id] = user; + } + const channelName = this.getDirectChannelName(UserStore.getCurrentId(), user.id); let channel = ChannelStore.getByName(channelName); |