summaryrefslogtreecommitdiffstats
path: root/webapp/components/quick_switch_modal/quick_switch_modal.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/components/quick_switch_modal/quick_switch_modal.jsx')
-rw-r--r--webapp/components/quick_switch_modal/quick_switch_modal.jsx33
1 files changed, 15 insertions, 18 deletions
diff --git a/webapp/components/quick_switch_modal/quick_switch_modal.jsx b/webapp/components/quick_switch_modal/quick_switch_modal.jsx
index 24eb8fcba..aed274510 100644
--- a/webapp/components/quick_switch_modal/quick_switch_modal.jsx
+++ b/webapp/components/quick_switch_modal/quick_switch_modal.jsx
@@ -22,7 +22,6 @@ import store from 'stores/redux_store.jsx';
const getState = store.getState;
import {getChannel} from 'mattermost-redux/selectors/entities/channels';
-import {getUserByUsername} from 'mattermost-redux/selectors/entities/users';
const CHANNEL_MODE = 'channel';
const TEAM_MODE = 'team';
@@ -141,24 +140,22 @@ export default class QuickSwitchModal extends React.PureComponent {
if (this.state.mode === CHANNEL_MODE) {
const selectedChannel = selected.channel;
if (selectedChannel.type === Constants.DM_CHANNEL) {
- const user = getUserByUsername(getState(), selectedChannel.name);
-
- if (user) {
- openDirectChannelToUser(
- user.id,
- (ch) => {
- channel = ch;
- this.switchToChannel(channel);
- },
- () => {
- channel = null;
- this.switchToChannel(channel);
- }
- );
- }
- } else {
+ openDirectChannelToUser(
+ selectedChannel.id,
+ (ch) => {
+ channel = ch;
+ this.switchToChannel(channel);
+ },
+ () => {
+ channel = null;
+ this.switchToChannel(channel);
+ }
+ );
+ } else if (selectedChannel.type === Constants.GM_CHANNEL) {
channel = getChannel(getState(), selectedChannel.id);
this.switchToChannel(channel);
+ } else {
+ this.switchToChannel(selectedChannel);
}
} else {
browserHistory.push('/' + selected.name);
@@ -287,7 +284,7 @@ export default class QuickSwitchModal extends React.PureComponent {
help = (
<FormattedMessage
id='quick_switch_modal.help_no_team'
- defaultMessage='Start typing then use ↑↓ to browse, ↵ to select, and ESC to dismiss.'
+ defaultMessage='Type to find a channel. Use ↑↓ to browse, ↵ to select, ESC to dismiss.'
/>
);
}