Goto /home when forgetting the last room

This commit is contained in:
Luke Barnard 2017-06-09 10:28:45 +01:00
parent f680bb5d3c
commit c7229967a6

View file

@ -570,6 +570,12 @@ module.exports = React.createClass({
const allRooms = RoomListSorter.mostRecentActivityFirst( const allRooms = RoomListSorter.mostRecentActivityFirst(
MatrixClientPeg.get().getRooms(), MatrixClientPeg.get().getRooms(),
); );
if (allRooms.length === 0) {
dis.dispatch({
action: 'view_home_page',
});
return;
}
let roomIndex = -1; let roomIndex = -1;
for (let i = 0; i < allRooms.length; ++i) { for (let i = 0; i < allRooms.length; ++i) {
if (allRooms[i].roomId == this.state.currentRoomId) { if (allRooms[i].roomId == this.state.currentRoomId) {