If we were loaded with a room alias, don't lose that alias when we try to load the corresponding room.
This commit is contained in:
parent
18be8530fe
commit
eb36a2b242
1 changed files with 24 additions and 7 deletions
|
@ -138,6 +138,12 @@ module.exports = {
|
||||||
currentRoom: payload.room_id,
|
currentRoom: payload.room_id,
|
||||||
page_type: this.PageTypes.RoomView,
|
page_type: this.PageTypes.RoomView,
|
||||||
});
|
});
|
||||||
|
if (this.sdkReady) {
|
||||||
|
// if the SDK is not ready yet, remember what room
|
||||||
|
// we're supposed to be on but don't notify about
|
||||||
|
// the new screen yet (we won't be showing it yet)
|
||||||
|
// The normal case where this happens is navigating
|
||||||
|
// to the room in the URL bar on page load.
|
||||||
var presentedId = payload.room_id;
|
var presentedId = payload.room_id;
|
||||||
var room = MatrixClientPeg.get().getRoom(payload.room_id);
|
var room = MatrixClientPeg.get().getRoom(payload.room_id);
|
||||||
if (room) {
|
if (room) {
|
||||||
|
@ -145,6 +151,7 @@ module.exports = {
|
||||||
if (theAlias) presentedId = theAlias;
|
if (theAlias) presentedId = theAlias;
|
||||||
}
|
}
|
||||||
this.notifyNewScreen('room/'+presentedId);
|
this.notifyNewScreen('room/'+presentedId);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'view_prev_room':
|
case 'view_prev_room':
|
||||||
roomIndexDelta = -1;
|
roomIndexDelta = -1;
|
||||||
|
@ -200,6 +207,7 @@ module.exports = {
|
||||||
var cli = MatrixClientPeg.get();
|
var cli = MatrixClientPeg.get();
|
||||||
var self = this;
|
var self = this;
|
||||||
cli.on('syncComplete', function() {
|
cli.on('syncComplete', function() {
|
||||||
|
self.sdkReady = true;
|
||||||
if (!self.state.currentRoom) {
|
if (!self.state.currentRoom) {
|
||||||
var firstRoom = null;
|
var firstRoom = null;
|
||||||
if (cli.getRooms() && cli.getRooms().length) {
|
if (cli.getRooms() && cli.getRooms().length) {
|
||||||
|
@ -207,13 +215,22 @@ module.exports = {
|
||||||
cli.getRooms()
|
cli.getRooms()
|
||||||
)[0].roomId;
|
)[0].roomId;
|
||||||
self.setState({ready: true, currentRoom: firstRoom, page_type: self.PageTypes.RoomView});
|
self.setState({ready: true, currentRoom: firstRoom, page_type: self.PageTypes.RoomView});
|
||||||
self.notifyNewScreen('room/'+firstRoom);
|
|
||||||
} else {
|
} else {
|
||||||
self.setState({ready: true, page_type: self.PageTypes.RoomDirectory});
|
self.setState({ready: true, page_type: self.PageTypes.RoomDirectory});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
self.setState({ready: true, currentRoom: self.state.currentRoom});
|
self.setState({ready: true, currentRoom: self.state.currentRoom});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// we notifyNewScreen now because now the room will actually be displayed,
|
||||||
|
// and (mostly) now we can get the correct alias.
|
||||||
|
var presentedId = self.state.currentRoom;
|
||||||
|
var room = MatrixClientPeg.get().getRoom(self.state.currentRoom);
|
||||||
|
if (room) {
|
||||||
|
var theAlias = MatrixTools.getCanonicalAliasForRoom(room);
|
||||||
|
if (theAlias) presentedId = theAlias;
|
||||||
|
}
|
||||||
|
self.notifyNewScreen('room/'+presentedId);
|
||||||
dis.dispatch({action: 'focus_composer'});
|
dis.dispatch({action: 'focus_composer'});
|
||||||
});
|
});
|
||||||
cli.on('Call.incoming', function(call) {
|
cli.on('Call.incoming', function(call) {
|
||||||
|
|
Loading…
Reference in a new issue