Use RVS to indicate "joining" when setting a mxid

This prevents RoomView from doing any peeking whilst the join/registration is in progress, causing weirdness with TimelinePanel getPendingEventList (which throws an error if called when peeking).
This commit is contained in:
Luke Barnard 2017-05-25 17:04:42 +01:00
parent 6218a8615a
commit 91edc06441
2 changed files with 20 additions and 5 deletions

View file

@ -671,10 +671,6 @@ module.exports = React.createClass({
// compatability workaround, let's not bother. // compatability workaround, let's not bother.
Rooms.setDMRoom(this.state.room.roomId, me.events.member.getSender()).done(); Rooms.setDMRoom(this.state.room.roomId, me.events.member.getSender()).done();
} }
this.setState({
joining: false
});
} }
}, 500), }, 500),
@ -762,12 +758,22 @@ module.exports = React.createClass({
}, },
}); });
// Don't peek whilst registering otherwise getPendingEventList complains
// Do this by indicating our intention to join
dis.dispatch({
action: 'will_join',
});
const SetMxIdDialog = sdk.getComponent('views.dialogs.SetMxIdDialog'); const SetMxIdDialog = sdk.getComponent('views.dialogs.SetMxIdDialog');
const close = Modal.createDialog(SetMxIdDialog, { const close = Modal.createDialog(SetMxIdDialog, {
homeserverUrl: cli.getHomeserverUrl(), homeserverUrl: cli.getHomeserverUrl(),
onFinished: (submitted, credentials) => { onFinished: (submitted, credentials) => {
if (submitted) { if (submitted) {
this.props.onRegistered(credentials); this.props.onRegistered(credentials);
} else {
dis.dispatch({
action: 'cancel_join',
});
} }
}, },
onDifferentServerClicked: (ev) => { onDifferentServerClicked: (ev) => {

View file

@ -58,7 +58,16 @@ class RoomViewStore extends Store {
case 'view_room': case 'view_room':
this._viewRoom(payload); this._viewRoom(payload);
break; break;
case 'will_join':
this._setState({
joining: true,
});
break;
case 'cancel_join':
this._setState({
joining: false,
});
break;
// join_room: // join_room:
// - opts: options for joinRoom // - opts: options for joinRoom
case 'join_room': case 'join_room':