From 2b393ff19350bc250ff37d662a6623926f5ebe83 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Thu, 25 Jun 2020 09:27:01 +0200 Subject: [PATCH] Sort invites on top --- lib/src/client.dart | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/src/client.dart b/lib/src/client.dart index 10a8e91f..2a7a2855 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -1076,10 +1076,12 @@ class Client { /// The compare function how the rooms should be sorted internally. By default /// rooms are sorted by timestamp of the last m.room.message event or the last /// event if there is no known message. - RoomSorter sortRoomsBy = (a, b) => (a.isFavourite != b.isFavourite) - ? (a.isFavourite ? -1 : 1) - : b.timeCreated.millisecondsSinceEpoch - .compareTo(a.timeCreated.millisecondsSinceEpoch); + RoomSorter sortRoomsBy = (a, b) => (a.membership != b.membership) + ? (a.membership == Membership.invite ? -1 : 1) + : (a.isFavourite != b.isFavourite) + ? (a.isFavourite ? -1 : 1) + : b.timeCreated.millisecondsSinceEpoch + .compareTo(a.timeCreated.millisecondsSinceEpoch); void _sortRooms() { if (prevBatch == null || _sortLock || rooms.length < 2) return;