From 43c703e216c4145f5c61ed3b7453d72bd20306d0 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Mon, 21 Nov 2016 13:03:54 -0500 Subject: PLT-4787 Fixed not being able to join a channel through a link after opening the More Channels modal (#4616) --- webapp/components/post_view/post_view_cache.jsx | 7 ++++--- webapp/routes/route_team.jsx | 9 ++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'webapp') diff --git a/webapp/components/post_view/post_view_cache.jsx b/webapp/components/post_view/post_view_cache.jsx index c1b278c35..3b6123b09 100644 --- a/webapp/components/post_view/post_view_cache.jsx +++ b/webapp/components/post_view/post_view_cache.jsx @@ -17,11 +17,12 @@ export default class PostViewCache extends React.Component { this.onChannelChange = this.onChannelChange.bind(this); + const currentChannelId = ChannelStore.getCurrentId(); const channel = ChannelStore.getCurrent(); this.state = { - currentChannelId: channel.id, - channels: [channel] + currentChannelId, + channels: channel ? [channel] : [] }; } @@ -40,7 +41,7 @@ export default class PostViewCache extends React.Component { const channels = Object.assign([], this.state.channels); const currentChannel = ChannelStore.getCurrent(); - if (currentChannel == null) { + if (!currentChannel) { return; } diff --git a/webapp/routes/route_team.jsx b/webapp/routes/route_team.jsx index 4bdfd1cc6..7d4c0c80c 100644 --- a/webapp/routes/route_team.jsx +++ b/webapp/routes/route_team.jsx @@ -29,13 +29,16 @@ function doChannelChange(state, replace, callback) { channel = JSON.parse(state.location.query.fakechannel); } else { channel = ChannelStore.getByName(state.params.channel); - if (!channel) { - channel = ChannelStore.getMoreByName(state.params.channel); - } + if (!channel) { Client.joinChannelByName( state.params.channel, (data) => { + AppDispatcher.handleServerAction({ + type: ActionTypes.RECEIVED_CHANNEL, + channel: data + }); + GlobalActions.emitChannelClickEvent(data); callback(); }, -- cgit v1.2.3-1-g7c22