From 0c61c52480331410bbb8adf8fd284e00e0954015 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 2 Aug 2016 19:02:07 +0100 Subject: [PATCH] Just use Lifecycle.setLoggedIn --- src/components/structures/MatrixChat.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index d0442ae235..1861366a96 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -162,7 +162,7 @@ module.exports = React.createClass({ this.props.startingQueryParams.guest_access_token) { this._autoRegisterAsGuest = false; - this._onHaveCredentials({ + Lifecycle.setLoggedIn({ userId: this.props.startingQueryParams.guest_user_id, accessToken: this.props.startingQueryParams.guest_access_token, homeserverUrl: this.getDefaultHsUrl(), @@ -235,7 +235,7 @@ module.exports = React.createClass({ MatrixClientPeg.get().registerGuest().done(function(creds) { console.log("Registered as guest: %s", creds.user_id); self._setAutoRegisterAsGuest(false); - self._onHaveCredentials({ + Lifecycle.setLoggedIn({ userId: creds.user_id, accessToken: creds.access_token, homeserverUrl: hsUrl, @@ -577,11 +577,6 @@ module.exports = React.createClass({ this.scrollStateMap[roomId] = state; }, - _onHaveCredentials: function(credentials) { - credentials.guest = Boolean(credentials.guest); - Lifecycle.setLoggedIn(credentials); - }, - _onLoggedIn: function(credentials) { this.guestCreds = null; this.setState({ @@ -909,13 +904,13 @@ module.exports = React.createClass({ onReturnToGuestClick: function() { // reanimate our guest login if (this.guestCreds) { - this._onHaveCredentials(this.guestCreds); + Lifecycle.setLoggedIn(this.guestCreds); this.guestCreds = null; } }, onRegistered: function(credentials) { - this._onHaveCredentials(credentials); + Lifecycle.setLoggedIn(credentials); // do post-registration stuff // This now goes straight to user settings // We use _setPage since if we wait for @@ -1137,7 +1132,7 @@ module.exports = React.createClass({ } else { return (