From c14886a1ee81ed7fc1e47168085806a80a9f7ddf Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 8 Jul 2015 18:21:57 +0100 Subject: [PATCH] rename to mostRecentActivityFirst to disambiguate from sorting by when you joined a room, which this is not. --- src/RoomListSorter.js | 4 ++-- src/controllers/organisms/RoomList.js | 2 +- src/controllers/pages/MatrixChat.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/RoomListSorter.js b/src/RoomListSorter.js index d5d3ab1fbb..bc7a001670 100644 --- a/src/RoomListSorter.js +++ b/src/RoomListSorter.js @@ -20,12 +20,12 @@ function tsOfNewestEvent(room) { return room.timeline[room.timeline.length - 1].getTs(); } -function mostRecentFirst(roomList) { +function mostRecentActivityFirst(roomList) { return roomList.sort(function(a,b) { return tsOfNewestEvent(b) - tsOfNewestEvent(a); }); } module.exports = { - mostRecentFirst: mostRecentFirst + mostRecentActivityFirst: mostRecentActivityFirst }; diff --git a/src/controllers/organisms/RoomList.js b/src/controllers/organisms/RoomList.js index 87413e18f2..224c2e12bd 100644 --- a/src/controllers/organisms/RoomList.js +++ b/src/controllers/organisms/RoomList.js @@ -96,7 +96,7 @@ module.exports = { }, getRoomList() { - return RoomListSorter.mostRecentFirst(MatrixClientPeg.get().getRooms()); + return RoomListSorter.mostRecentActivityFirst(MatrixClientPeg.get().getRooms()); }, makeRoomTiles: function() { diff --git a/src/controllers/pages/MatrixChat.js b/src/controllers/pages/MatrixChat.js index 94c933a53f..fe126e508c 100644 --- a/src/controllers/pages/MatrixChat.js +++ b/src/controllers/pages/MatrixChat.js @@ -107,7 +107,7 @@ module.exports = { cli.on('syncComplete', function() { var firstRoom = null; if (cli.getRooms() && cli.getRooms().length) { - firstRoom = RoomListSorter.mostRecentFirst( + firstRoom = RoomListSorter.mostRecentActivityFirst( cli.getRooms() )[0].roomId; }