Don't go & load the first room if we've already been told to load a different one.

This commit is contained in:
David Baker 2015-07-20 14:09:41 -07:00
parent 36b1280f0c
commit e0673eee29

View file

@ -173,14 +173,18 @@ module.exports = {
var cli = MatrixClientPeg.get(); var cli = MatrixClientPeg.get();
var self = this; var self = this;
cli.on('syncComplete', function() { cli.on('syncComplete', function() {
var firstRoom = null; if (!self.state.currentRoom) {
if (cli.getRooms() && cli.getRooms().length) { var firstRoom = null;
firstRoom = RoomListSorter.mostRecentActivityFirst( if (cli.getRooms() && cli.getRooms().length) {
cli.getRooms() firstRoom = RoomListSorter.mostRecentActivityFirst(
)[0].roomId; cli.getRooms()
)[0].roomId;
}
self.setState({ready: true, currentRoom: firstRoom});
self.notifyNewScreen('room/'+firstRoom);
} else {
self.setState({ready: true});
} }
self.setState({ready: true, currentRoom: firstRoom});
self.notifyNewScreen('room/'+firstRoom);
dis.dispatch({action: 'focus_composer'}); dis.dispatch({action: 'focus_composer'});
}); });
cli.on('Call.incoming', function(call) { cli.on('Call.incoming', function(call) {