From b457a4e4a274094e23a4034e18ef6f8d4b750ec6 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Wed, 16 Mar 2016 11:48:32 +0000 Subject: [PATCH] improve semantics for when the 'return to app' prompt is shown --- src/components/structures/MatrixChat.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index 5780e04ec2..21174be966 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -885,6 +885,7 @@ module.exports = React.createClass({ onReturnToGuestClick: function() { // reanimate our guest login this.onLoggedIn(this.state.guestCreds); + this.setState({ guestCreds: null }); }, onRegistered: function(credentials) { @@ -1072,7 +1073,7 @@ module.exports = React.createClass({ onLoggedIn={this.onRegistered} onLoginClick={this.onLoginClick} onRegisterClick={this.onRegisterClick} - onCancelClick={ MatrixClientPeg.get() && MatrixClientPeg.get().isGuest() ? this.onReturnToGuestClick : null } + onCancelClick={ this.state.guestCreds ? this.onReturnToGuestClick : null } /> ); } else if (this.state.screen == 'forgot_password') { @@ -1096,7 +1097,7 @@ module.exports = React.createClass({ customIsUrl={this.getCurrentIsUrl()} onForgotPasswordClick={this.onForgotPasswordClick} onLoginAsGuestClick={this.props.enableGuest && this.props.config && this.props.config.default_hs_url ? this._registerAsGuest: undefined} - onCancelClick={ MatrixClientPeg.get() && MatrixClientPeg.get().isGuest() ? this.onReturnToGuestClick : null } + onCancelClick={ this.state.guestCreds ? this.onReturnToGuestClick : null } /> ); }