Sort invites on top

This commit is contained in:
Christian Pauly 2020-06-25 09:27:01 +02:00
parent 2cd4ab11ce
commit 2b393ff193

View file

@ -1076,10 +1076,12 @@ class Client {
/// The compare function how the rooms should be sorted internally. By default /// 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 /// rooms are sorted by timestamp of the last m.room.message event or the last
/// event if there is no known message. /// event if there is no known message.
RoomSorter sortRoomsBy = (a, b) => (a.isFavourite != b.isFavourite) RoomSorter sortRoomsBy = (a, b) => (a.membership != b.membership)
? (a.isFavourite ? -1 : 1) ? (a.membership == Membership.invite ? -1 : 1)
: b.timeCreated.millisecondsSinceEpoch : (a.isFavourite != b.isFavourite)
.compareTo(a.timeCreated.millisecondsSinceEpoch); ? (a.isFavourite ? -1 : 1)
: b.timeCreated.millisecondsSinceEpoch
.compareTo(a.timeCreated.millisecondsSinceEpoch);
void _sortRooms() { void _sortRooms() {
if (prevBatch == null || _sortLock || rooms.length < 2) return; if (prevBatch == null || _sortLock || rooms.length < 2) return;