Show higher power-level room members first

This commit is contained in:
miruka 2019-11-30 04:04:24 -04:00
parent 61c2919c7f
commit a35526a0b5

View File

@ -94,9 +94,10 @@ class Member(ModelItem):
power_level: int = 0 power_level: int = 0
def __lt__(self, other: "Member") -> bool: def __lt__(self, other: "Member") -> bool:
name = self.display_name or self.user_id[1:] # Sort by name, but have members with higher power-level first
other_name = other.display_name or other.user_id[1:] name = (self.display_name or self.user_id[1:]).lower()
return name.lower() < other_name.lower() other_name = (other.display_name or other.user_id[1:]).lower()
return (other.power_level, name) < (self.power_level, other_name)
@property @property