diff options
author | enahum <nahumhbl@gmail.com> | 2016-12-08 12:20:03 -0300 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2016-12-08 10:20:03 -0500 |
commit | b57c9fec89f736de8622218d6dc779012a266a91 (patch) | |
tree | f56ba6e73f7b6e7b2177231a7532cc40d7422e30 /webapp/components/suggestion/switch_channel_provider.jsx | |
parent | c4974374d9840caa6ec496c138a6220dd40afa54 (diff) | |
download | chat-b57c9fec89f736de8622218d6dc779012a266a91.tar.gz chat-b57c9fec89f736de8622218d6dc779012a266a91.tar.bz2 chat-b57c9fec89f736de8622218d6dc779012a266a91.zip |
PLT-4894 channel switcher (CTRL+K) to match message autocomplete (#4733)
* PLT-4894 Change name display of direct messages in channel switcher (CTRL+K) to match message autocomplete
* Addressing feedback
Diffstat (limited to 'webapp/components/suggestion/switch_channel_provider.jsx')
-rw-r--r-- | webapp/components/suggestion/switch_channel_provider.jsx | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/webapp/components/suggestion/switch_channel_provider.jsx b/webapp/components/suggestion/switch_channel_provider.jsx index cb907862a..b41bc4f11 100644 --- a/webapp/components/suggestion/switch_channel_provider.jsx +++ b/webapp/components/suggestion/switch_channel_provider.jsx @@ -7,7 +7,7 @@ import ChannelStore from 'stores/channel_store.jsx'; import UserStore from 'stores/user_store.jsx'; import {autocompleteUsers} from 'actions/user_actions.jsx'; - +import Client from 'client/web_client.jsx'; import AppDispatcher from 'dispatcher/app_dispatcher.jsx'; import {Constants, ActionTypes} from 'utils/constants.jsx'; import * as Utils from 'utils/utils.jsx'; @@ -25,7 +25,7 @@ class SwitchChannelSuggestion extends Suggestion { let displayName = ''; if (item.type === Constants.DM_CHANNEL) { - displayName = item.display_name + ' ' + Utils.localizeMessage('channel_switch_modal.dm', '(Direct Message)'); + displayName = item.display_name; } else { displayName = item.display_name + ' (' + item.name + ')'; } @@ -36,7 +36,14 @@ class SwitchChannelSuggestion extends Suggestion { } else if (item.type === Constants.PRIVATE_CHANNEL) { icon = <div className='status'><i className='fa fa-lock'/></div>; } else { - icon = <div className='status'><i className='fa fa-user'/></div>; + icon = ( + <div className='pull-left'> + <img + className='mention__image' + src={Client.getUsersRoute() + '/' + item.id + '/image?time=' + item.update_at} + /> + </div> + ); } return ( @@ -81,14 +88,25 @@ export default class SwitchChannelProvider { const userMap = {}; for (let i = 0; i < users.length; i++) { const user = users[i]; + let displayName = `@${user.username} `; if (user.id === currentId) { continue; } + if ((user.first_name || user.last_name) && user.nickname) { + displayName += `- ${Utils.getFullName(user)} (${user.nickname})`; + } else if (user.nickname) { + displayName += `- (${user.nickname})`; + } else if (user.first_name || user.last_name) { + displayName += `- ${Utils.getFullName(user)}`; + } + const newChannel = { - display_name: user.username, - name: user.username + ' ' + Utils.localizeMessage('channel_switch_modal.dm', '(Direct Message)'), + display_name: displayName, + name: user.username, + id: user.id, + update_at: user.update_at, type: Constants.DM_CHANNEL }; channels.push(newChannel); |