diff --git a/src/controllers/molecules/ChangeAvatar.js b/src/controllers/molecules/ChangeAvatar.js index 093badfe8f..7e8f959ebf 100644 --- a/src/controllers/molecules/ChangeAvatar.js +++ b/src/controllers/molecules/ChangeAvatar.js @@ -36,6 +36,16 @@ module.exports = { } }, + componentWillReceiveProps: function(newProps) { + if (this.avatarSet) { + // don't clobber what the user has just set + return; + } + this.setState({ + avatarUrl: newProps.initialAvatarUrl + }); + }, + setAvatarFromFile: function(file) { var newUrl = null; diff --git a/src/controllers/molecules/ChangeDisplayName.js b/src/controllers/molecules/ChangeDisplayName.js index 7e49b8f725..afef82772c 100644 --- a/src/controllers/molecules/ChangeDisplayName.js +++ b/src/controllers/molecules/ChangeDisplayName.js @@ -15,10 +15,14 @@ limitations under the License. */ 'use strict'; - +var React = require('react'); var MatrixClientPeg = require("../../MatrixClientPeg"); module.exports = { + propTypes: { + onFinished: React.PropTypes.func + }, + getDefaultProps: function() { return { onFinished: function() {}, diff --git a/src/controllers/pages/MatrixChat.js b/src/controllers/pages/MatrixChat.js index 4655011a45..af2c78ff26 100644 --- a/src/controllers/pages/MatrixChat.js +++ b/src/controllers/pages/MatrixChat.js @@ -144,6 +144,11 @@ module.exports = { }); this.notifyNewScreen('login'); break; + case 'start_post_registration': + this.setState({ // don't clobber logged_in status + screen: 'post_registration' + }); + break; case 'token_login': if (this.state.logged_in) return; @@ -298,13 +303,11 @@ module.exports = { }, onLoggedIn: function(credentials) { - if (credentials) { // registration doesn't do this yet - console.log("onLoggedIn => %s", credentials.userId); - MatrixClientPeg.replaceUsingAccessToken( - credentials.homeserverUrl, credentials.identityServerUrl, - credentials.userId, credentials.accessToken - ); - } + console.log("onLoggedIn => %s", credentials.userId); + MatrixClientPeg.replaceUsingAccessToken( + credentials.homeserverUrl, credentials.identityServerUrl, + credentials.userId, credentials.accessToken + ); this.setState({ screen: undefined, logged_in: true @@ -431,6 +434,10 @@ module.exports = { dis.dispatch({ action: 'view_room_directory', }); + } else if (screen == 'post_registration') { + dis.dispatch({ + action: 'start_post_registration', + }); } else if (screen.indexOf('room/') == 0) { var roomString = screen.split('/')[1]; if (roomString[0] == '#') { @@ -452,6 +459,9 @@ module.exports = { }); } } + else { + console.error("Unknown screen : %s", screen); + } }, notifyNewScreen: function(screen) {