Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #753 from matrix-org/luke/fix-register-not-routing
Browse files Browse the repository at this point in the history
Do routing to /register _onLoadCompleted
  • Loading branch information
dbkr authored Mar 15, 2017
2 parents 3325dd6 + 5330e47 commit 648ad8d
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions src/components/structures/MatrixChat.js
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,14 @@ module.exports = React.createClass({
_onLoadCompleted: function() {
this.props.onLoadCompleted();
this.setState({loading: false});

// Show screens (like 'register') that need to be shown without onLoggedIn
// being called. 'register' needs to be routed here when the email confirmation
// link is clicked on.
if (this.state.screenAfterLogin &&
['register'].indexOf(this.state.screenAfterLogin.screen) !== -1) {
this._showScreenAfterLogin();
}
},

/**
Expand Down Expand Up @@ -751,24 +759,26 @@ module.exports = React.createClass({
logged_in: true,
});

if (teamToken) {
this._teamToken = teamToken;
dis.dispatch({action: 'view_home_page'});
} else if (this._is_registered) {
dis.dispatch({action: 'view_user_settings'});
} else {
this._showScreenAfterLogin();
}
},

_showScreenAfterLogin: function() {
// If screenAfterLogin is set, use that, then null it so that a second login will
// result in view_home_page, _user_settings or _room_directory
if (this.state.screenAfterLogin && this.state.screenAfterLogin.screen) {
this.showScreen(
this.state.screenAfterLogin.screen,
this.state.screenAfterLogin.params
);
this.notifyNewScreen(this.state.screenAfterLogin.screen);
this.setState({screenAfterLogin: null});
return;
} else {
this.setState({screen: undefined});
}

if (teamToken) {
this._teamToken = teamToken;
dis.dispatch({action: 'view_home_page'});
} else if (this._is_registered) {
dis.dispatch({action: 'view_user_settings'});
} else {
dis.dispatch({action: 'view_room_directory'});
}
Expand Down

0 comments on commit 648ad8d

Please sign in to comment.