summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge Goldberg <george@gberg.me>2017-01-17 13:36:06 +0000
committerJoram Wilander <jwawilander@gmail.com>2017-01-17 08:36:06 -0500
commit97a51b0e31692b7f86a9971ad36d62b04100fffb (patch)
treeab0f23aae640b86259786b9e52cd229cf6ffff01
parent1fc26a152f81e6d37574e380ace5d8140c034117 (diff)
downloadchat-97a51b0e31692b7f86a9971ad36d62b04100fffb.tar.gz
chat-97a51b0e31692b7f86a9971ad36d62b04100fffb.tar.bz2
chat-97a51b0e31692b7f86a9971ad36d62b04100fffb.zip
PLT-5156 Fix Channel Switcher Console Errors. (#5058)
-rw-r--r--webapp/components/channel_switch_modal.jsx13
-rw-r--r--webapp/i18n/en.json1
2 files changed, 13 insertions, 1 deletions
diff --git a/webapp/components/channel_switch_modal.jsx b/webapp/components/channel_switch_modal.jsx
index 2f8595c78..fc66e06b1 100644
--- a/webapp/components/channel_switch_modal.jsx
+++ b/webapp/components/channel_switch_modal.jsx
@@ -64,6 +64,7 @@ export default class SwitchChannelModal extends React.Component {
}
onExited() {
+ this.selected = null;
setTimeout(() => {
$('#post_textbox').get(0).focus();
});
@@ -71,6 +72,7 @@ export default class SwitchChannelModal extends React.Component {
onChange(e) {
this.setState({text: e.target.value});
+ this.selected = null;
}
onItemSelected(item) {
@@ -89,6 +91,15 @@ export default class SwitchChannelModal extends React.Component {
handleSubmit() {
let channel = null;
+ if (!this.selected) {
+ if (this.state.text !== '') {
+ this.setState({
+ error: Utils.localizeMessage('channel_switch_modal.not_found', 'No matches found.')
+ });
+ }
+ return;
+ }
+
if (this.selected.type === Constants.DM_CHANNEL) {
const user = UserStore.getProfileByUsername(this.selected.name);
@@ -117,7 +128,7 @@ export default class SwitchChannelModal extends React.Component {
this.onHide();
} else if (this.state.text !== '') {
this.setState({
- error: Utils.localizeMessage('channel_switch_modal.not_found', 'No matches found.')
+ error: Utils.localizeMessage('channel_switch_modal.failed_to_open', 'Failed to open channel.')
});
}
}
diff --git a/webapp/i18n/en.json b/webapp/i18n/en.json
index 3e0f6117a..ff2f7d071 100644
--- a/webapp/i18n/en.json
+++ b/webapp/i18n/en.json
@@ -1120,6 +1120,7 @@
"channel_notifications.unreadInfo": "The channel name is bolded in the sidebar when there are unread messages. Selecting \"Only for mentions\" will bold the channel only when you are mentioned.",
"channel_select.placeholder": "--- Select a channel ---",
"channel_switch_modal.dm": "(Direct Message)",
+ "channel_switch_modal.failed_to_open": "Failed to open channel.",
"channel_switch_modal.help": "Type channel name. Use ↑↓ to browse, TAB to select, ↵ to confirm, ESC to dismiss",
"channel_switch_modal.not_found": "No matches found.",
"channel_switch_modal.submit": "Switch",