summaryrefslogtreecommitdiffstats
path: root/webapp/components
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2016-11-21 16:08:29 -0500
committerGitHub <noreply@github.com>2016-11-21 16:08:29 -0500
commit3c0f8c29db3d5cc5901b1e30710f1b900980920a (patch)
tree77345e7030a93ba35dc1ed97e50cecb8d8bb7e8d /webapp/components
parent43c703e216c4145f5c61ed3b7453d72bd20306d0 (diff)
downloadchat-3c0f8c29db3d5cc5901b1e30710f1b900980920a.tar.gz
chat-3c0f8c29db3d5cc5901b1e30710f1b900980920a.tar.bz2
chat-3c0f8c29db3d5cc5901b1e30710f1b900980920a.zip
Fixed error being thrown by ChannelHeader when switching teams (#4619)
* Fixed error being thrown by ChannelHeader when switching teams * Close SidebarHeaderDropdown after switching teams
Diffstat (limited to 'webapp/components')
-rw-r--r--webapp/components/channel_header.jsx2
-rw-r--r--webapp/components/sidebar_header_dropdown.jsx7
2 files changed, 8 insertions, 1 deletions
diff --git a/webapp/components/channel_header.jsx b/webapp/components/channel_header.jsx
index 213f7fd0a..50b860287 100644
--- a/webapp/components/channel_header.jsx
+++ b/webapp/components/channel_header.jsx
@@ -69,7 +69,7 @@ export default class ChannelHeader extends React.Component {
const users = UserStore.getProfileListInChannel(this.props.channelId);
let otherUserId = null;
- if (channel.type === 'D') {
+ if (channel && channel.type === 'D') {
otherUserId = Utils.getUserIdFromChannelName(channel);
}
diff --git a/webapp/components/sidebar_header_dropdown.jsx b/webapp/components/sidebar_header_dropdown.jsx
index b665eef52..aa5226702 100644
--- a/webapp/components/sidebar_header_dropdown.jsx
+++ b/webapp/components/sidebar_header_dropdown.jsx
@@ -45,6 +45,7 @@ export default class SidebarHeaderDropdown extends React.Component {
this.showGetTeamInviteLinkModal = this.showGetTeamInviteLinkModal.bind(this);
this.showTeamMembersModal = this.showTeamMembersModal.bind(this);
this.hideTeamMembersModal = this.hideTeamMembersModal.bind(this);
+ this.handleSwitchTeams = this.handleSwitchTeams.bind(this);
this.onTeamChange = this.onTeamChange.bind(this);
this.openAccountSettings = this.openAccountSettings.bind(this);
@@ -131,6 +132,11 @@ export default class SidebarHeaderDropdown extends React.Component {
});
}
+ handleSwitchTeams() {
+ // The actual switching of teams is handled by the react-router Link
+ this.setState({showDropdown: false});
+ }
+
componentDidMount() {
TeamStore.addChangeListener(this.onTeamChange);
document.addEventListener('keydown', this.openAccountSettings);
@@ -367,6 +373,7 @@ export default class SidebarHeaderDropdown extends React.Component {
<li key={'team_' + team.name}>
<Link
to={'/' + team.name + '/channels/town-square'}
+ onClick={this.handleSwitchTeams}
>
<FormattedMessage
id='navbar_dropdown.switchTo'