RoomView: Handle joining federated rooms

This hopefully fixes an issue where joining a federated room via the directory
would get stuck at a spinner of doom, due to us not recognising the room in
question when it came down the /sync. We now catch the room id in the response
from the /join, and use it to match up the room in onRoom.

props.roomAlias, props.roomId, and state.room.roomId were somewhat confusing,
so I've tried to rationalise them:

 * props.roomAlias (named thus to stop you assuming it's a room id) is the
   thing that the parent component uses to identify the room of interest, and
   can be either an ID or an alias (ie, it replaces props.roomId and
   props.roomAlias)

 * Everything that needs a room ID now has to get it from state.room.roomId.
This commit is contained in:
Richard van der Hoff 2016-04-12 19:25:07 +01:00
parent f9785f68af
commit 93a142480c
2 changed files with 106 additions and 82 deletions

View file

@ -624,10 +624,13 @@ module.exports = React.createClass({
if (!this.refs.roomView) {
return;
}
var roomview = this.refs.roomView;
var roomId = this.refs.roomView.getRoomId();
if (!roomId) {
return;
}
var state = roomview.getScrollState();
this.scrollStateMap[roomview.props.roomId] = state;
this.scrollStateMap[roomId] = state;
},
onLoggedIn: function(credentials) {
@ -1052,8 +1055,7 @@ module.exports = React.createClass({
page_element = (
<RoomView
ref="roomView"
roomId={this.state.currentRoom}
roomAlias={this.state.currentRoomAlias}
roomAlias={this.state.currentRoom || this.state.currentRoomAlias}
eventId={this.state.initialEventId}
thirdPartyInvite={this.state.thirdPartyInvite}
oobData={this.state.roomOobData}