rename to mostRecentActivityFirst to disambiguate from sorting by when you joined a room, which this is not.
This commit is contained in:
parent
d58fdef362
commit
c14886a1ee
|
@ -20,12 +20,12 @@ function tsOfNewestEvent(room) {
|
||||||
return room.timeline[room.timeline.length - 1].getTs();
|
return room.timeline[room.timeline.length - 1].getTs();
|
||||||
}
|
}
|
||||||
|
|
||||||
function mostRecentFirst(roomList) {
|
function mostRecentActivityFirst(roomList) {
|
||||||
return roomList.sort(function(a,b) {
|
return roomList.sort(function(a,b) {
|
||||||
return tsOfNewestEvent(b) - tsOfNewestEvent(a);
|
return tsOfNewestEvent(b) - tsOfNewestEvent(a);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
mostRecentFirst: mostRecentFirst
|
mostRecentActivityFirst: mostRecentActivityFirst
|
||||||
};
|
};
|
||||||
|
|
|
@ -96,7 +96,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
|
|
||||||
getRoomList() {
|
getRoomList() {
|
||||||
return RoomListSorter.mostRecentFirst(MatrixClientPeg.get().getRooms());
|
return RoomListSorter.mostRecentActivityFirst(MatrixClientPeg.get().getRooms());
|
||||||
},
|
},
|
||||||
|
|
||||||
makeRoomTiles: function() {
|
makeRoomTiles: function() {
|
||||||
|
|
|
@ -107,7 +107,7 @@ module.exports = {
|
||||||
cli.on('syncComplete', function() {
|
cli.on('syncComplete', function() {
|
||||||
var firstRoom = null;
|
var firstRoom = null;
|
||||||
if (cli.getRooms() && cli.getRooms().length) {
|
if (cli.getRooms() && cli.getRooms().length) {
|
||||||
firstRoom = RoomListSorter.mostRecentFirst(
|
firstRoom = RoomListSorter.mostRecentActivityFirst(
|
||||||
cli.getRooms()
|
cli.getRooms()
|
||||||
)[0].roomId;
|
)[0].roomId;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue