From 4ac769168aa2a9035e83e6616bd747ba7ebed41c Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Fri, 10 Feb 2017 17:17:58 +0000 Subject: [PATCH 1/2] View /home on registered /w team --- src/components/structures/login/Registration.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/structures/login/Registration.js b/src/components/structures/login/Registration.js index efe7dae723a..bd4dad5d5f2 100644 --- a/src/components/structures/login/Registration.js +++ b/src/components/structures/login/Registration.js @@ -227,6 +227,9 @@ module.exports = React.createClass({ const teamToken = data.team_token; // Store for use /w welcome pages window.localStorage.setItem('mx_team_token', teamToken); + // Set the team token and view homepage + window.matrixChat._teamToken = teamToken; + window.mxDispatcher.dispatch({action: 'view_home_page'}); self._rtsClient.getTeam(teamToken).then((team) => { console.log( From 16e3365240b5d4c737d8626ceece0a918cefd5e9 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Mon, 13 Feb 2017 14:36:03 +0000 Subject: [PATCH 2/2] Use a callback prop instead of `window.` --- src/components/structures/MatrixChat.js | 6 ++++++ src/components/structures/login/Registration.js | 5 ++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index 8fdcf15e1b6..a2a7e346692 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -975,6 +975,11 @@ module.exports = React.createClass({ this._setPage(PageTypes.UserSettings); }, + onTeamMemberRegistered: function(teamToken) { + this._teamToken = teamToken; + this._setPage(PageTypes.HomePage); + }, + onFinishPostRegistration: function() { // Don't confuse this with "PageType" which is the middle window to show this.setState({ @@ -1103,6 +1108,7 @@ module.exports = React.createClass({ customIsUrl={this.getCurrentIsUrl()} registrationUrl={this.props.registrationUrl} defaultDeviceDisplayName={this.props.defaultDeviceDisplayName} + onTeamMemberRegistered={this.onTeamMemberRegistered} onLoggedIn={this.onRegistered} onLoginClick={this.onLoginClick} onRegisterClick={this.onRegisterClick} diff --git a/src/components/structures/login/Registration.js b/src/components/structures/login/Registration.js index bd4dad5d5f2..8af208de10e 100644 --- a/src/components/structures/login/Registration.js +++ b/src/components/structures/login/Registration.js @@ -58,6 +58,7 @@ module.exports = React.createClass({ teamServerURL: React.PropTypes.string.isRequired, }), teamSelected: React.PropTypes.object, + onTeamMemberRegistered: React.PropTypes.func.isRequired, defaultDeviceDisplayName: React.PropTypes.string, @@ -227,9 +228,7 @@ module.exports = React.createClass({ const teamToken = data.team_token; // Store for use /w welcome pages window.localStorage.setItem('mx_team_token', teamToken); - // Set the team token and view homepage - window.matrixChat._teamToken = teamToken; - window.mxDispatcher.dispatch({action: 'view_home_page'}); + self.props.onTeamMemberRegistered(teamToken); self._rtsClient.getTeam(teamToken).then((team) => { console.log(