Commit 27dfa032 authored by Sudheer's avatar Sudheer Committed by Christopher Speller
Browse files

Use last channel name for routing on team switch (#652)

parent f68972d5
......@@ -214,6 +214,18 @@ export default class NeedsTeam extends React.Component {
}
}
toLastChannel = () => {
let channelName = Constants.DEFAULT_CHANNEL;
const team = TeamStore.getByName(this.props.match.params.team);
const channelId = BrowserStore.getGlobalItem(team.id);
const channel = ChannelStore.getChannelById(channelId);
if (channel) {
channelName = channel.name;
}
return `${this.props.match.url}/channels/${channelName}`;
}
render() {
if (this.state.team === null || this.state.finishedFetchingChannels === false) {
return <div/>;
......@@ -266,7 +278,7 @@ export default class NeedsTeam extends React.Component {
path={'/:team/messages/:identifier'}
component={MessageIdentifierRouter}
/>
<Redirect to={`${this.props.match.url}/channels/town-square`}/>
<Redirect to={this.toLastChannel()}/>
</Switch>
</div>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment