Have a post-registration screen. Fix race in ChangeAvatar where if you hadn't got an initial avatar downloaded yet you couldn't update it after the component loaded.
This commit is contained in:
parent
ad60e23459
commit
d46e42f8e7
3 changed files with 30 additions and 9 deletions
|
@ -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) {
|
setAvatarFromFile: function(file) {
|
||||||
var newUrl = null;
|
var newUrl = null;
|
||||||
|
|
||||||
|
|
|
@ -15,10 +15,14 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
var React = require('react');
|
||||||
var MatrixClientPeg = require("../../MatrixClientPeg");
|
var MatrixClientPeg = require("../../MatrixClientPeg");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
propTypes: {
|
||||||
|
onFinished: React.PropTypes.func
|
||||||
|
},
|
||||||
|
|
||||||
getDefaultProps: function() {
|
getDefaultProps: function() {
|
||||||
return {
|
return {
|
||||||
onFinished: function() {},
|
onFinished: function() {},
|
||||||
|
|
|
@ -31,7 +31,7 @@ module.exports = {
|
||||||
RoomView: "room_view",
|
RoomView: "room_view",
|
||||||
UserSettings: "user_settings",
|
UserSettings: "user_settings",
|
||||||
CreateRoom: "create_room",
|
CreateRoom: "create_room",
|
||||||
RoomDirectory: "room_directory",
|
RoomDirectory: "room_directory"
|
||||||
},
|
},
|
||||||
|
|
||||||
AuxPanel: {
|
AuxPanel: {
|
||||||
|
@ -144,6 +144,11 @@ module.exports = {
|
||||||
});
|
});
|
||||||
this.notifyNewScreen('login');
|
this.notifyNewScreen('login');
|
||||||
break;
|
break;
|
||||||
|
case 'start_post_registration':
|
||||||
|
this.setState({ // don't clobber logged_in status
|
||||||
|
screen: 'post_registration'
|
||||||
|
});
|
||||||
|
break;
|
||||||
case 'token_login':
|
case 'token_login':
|
||||||
if (this.state.logged_in) return;
|
if (this.state.logged_in) return;
|
||||||
|
|
||||||
|
@ -298,13 +303,11 @@ module.exports = {
|
||||||
},
|
},
|
||||||
|
|
||||||
onLoggedIn: function(credentials) {
|
onLoggedIn: function(credentials) {
|
||||||
if (credentials) { // registration doesn't do this yet
|
console.log("onLoggedIn => %s", credentials.userId);
|
||||||
console.log("onLoggedIn => %s", credentials.userId);
|
MatrixClientPeg.replaceUsingAccessToken(
|
||||||
MatrixClientPeg.replaceUsingAccessToken(
|
credentials.homeserverUrl, credentials.identityServerUrl,
|
||||||
credentials.homeserverUrl, credentials.identityServerUrl,
|
credentials.userId, credentials.accessToken
|
||||||
credentials.userId, credentials.accessToken
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
this.setState({
|
this.setState({
|
||||||
screen: undefined,
|
screen: undefined,
|
||||||
logged_in: true
|
logged_in: true
|
||||||
|
@ -431,6 +434,10 @@ module.exports = {
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: 'view_room_directory',
|
action: 'view_room_directory',
|
||||||
});
|
});
|
||||||
|
} else if (screen == 'post_registration') {
|
||||||
|
dis.dispatch({
|
||||||
|
action: 'start_post_registration',
|
||||||
|
});
|
||||||
} else if (screen.indexOf('room/') == 0) {
|
} else if (screen.indexOf('room/') == 0) {
|
||||||
var roomString = screen.split('/')[1];
|
var roomString = screen.split('/')[1];
|
||||||
if (roomString[0] == '#') {
|
if (roomString[0] == '#') {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue