1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-07-24 06:02:08 +03:00

Handle only 1 room in the list

This commit is contained in:
Luke Barnard
2017-06-09 10:54:42 +01:00
parent c7229967a6
commit 19bb879fbf

View File

@ -570,7 +570,10 @@ module.exports = React.createClass({
const allRooms = RoomListSorter.mostRecentActivityFirst( const allRooms = RoomListSorter.mostRecentActivityFirst(
MatrixClientPeg.get().getRooms(), MatrixClientPeg.get().getRooms(),
); );
if (allRooms.length === 0) { // If there are 0 rooms or 1 room, view the home page because otherwise
// if there are 0, we end up trying to index into an empty array, and
// if there is 1, we end up viewing the same room.
if (allRooms.length < 2) {
dis.dispatch({ dis.dispatch({
action: 'view_home_page', action: 'view_home_page',
}); });