From 9ca66b60445dc3db7a0ae9beaafecb6049f2d24f Mon Sep 17 00:00:00 2001 From: miruka Date: Fri, 16 Aug 2019 12:19:43 -0400 Subject: [PATCH] Sort rooms by last event date again --- src/python/models/items.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/python/models/items.py b/src/python/models/items.py index 398f74a8..92493a72 100644 --- a/src/python/models/items.py +++ b/src/python/models/items.py @@ -47,10 +47,17 @@ class Room(ModelItem): if other.left and not self.left: return True - if other.inviter_id and not self.inviter_id: - return False if self.inviter_id and not other.inviter_id: return True + if other.inviter_id and not self.inviter_id: + return False + + if self.last_event and other.last_event: + return self.last_event["date"] > other.last_event["date"] + if self.last_event and not other.last_event: + return True + if other.last_event and not self.last_event: + return False name = self.display_name or self.room_id other_name = other.display_name or other.room_id