Remove pointless local_highlights
An event can only be considered a highlight if a push rule make it so, thus an event can never be locally highlighted only.
This commit is contained in:
@@ -379,10 +379,9 @@ class Backend:
|
||||
|
||||
if room:
|
||||
room.set_fields(
|
||||
unreads = 0,
|
||||
highlights = 0,
|
||||
local_unreads = False,
|
||||
local_highlights = False,
|
||||
unreads = 0,
|
||||
highlights = 0,
|
||||
local_unreads = False,
|
||||
)
|
||||
await client.update_account_unread_counts()
|
||||
|
||||
|
@@ -1833,10 +1833,9 @@ class MatrixClient(nio.AsyncClient):
|
||||
async def update_account_unread_counts(self) -> None:
|
||||
"""Recalculate total unread notifications/highlights for our account"""
|
||||
|
||||
unreads = 0
|
||||
highlights = 0
|
||||
local_unreads = False
|
||||
local_highlights = False
|
||||
unreads = 0
|
||||
highlights = 0
|
||||
local_unreads = False
|
||||
|
||||
for room in self.models[self.user_id, "rooms"].values():
|
||||
unreads += room.unreads
|
||||
@@ -1845,15 +1844,11 @@ class MatrixClient(nio.AsyncClient):
|
||||
if room.local_unreads:
|
||||
local_unreads = True
|
||||
|
||||
if room.local_highlights:
|
||||
local_highlights = True
|
||||
|
||||
account = self.models["accounts"][self.user_id]
|
||||
account.set_fields(
|
||||
total_unread = unreads,
|
||||
total_highlights = highlights,
|
||||
local_unreads = local_unreads,
|
||||
local_highlights = local_highlights,
|
||||
)
|
||||
|
||||
|
||||
@@ -1903,7 +1898,6 @@ class MatrixClient(nio.AsyncClient):
|
||||
last_event_date = datetime.fromtimestamp(0)
|
||||
typing_members = []
|
||||
local_unreads = False
|
||||
local_highlights = False
|
||||
update_account_unread_counts = True
|
||||
unverified_devices = (
|
||||
False
|
||||
@@ -1914,7 +1908,6 @@ class MatrixClient(nio.AsyncClient):
|
||||
last_event_date = registered.last_event_date
|
||||
typing_members = registered.typing_members
|
||||
local_unreads = registered.local_unreads
|
||||
local_highlights = registered.local_highlights
|
||||
update_account_unread_counts = (
|
||||
registered.unreads != room.unread_notifications or
|
||||
registered.highlights != room.unread_highlights
|
||||
@@ -1962,10 +1955,9 @@ class MatrixClient(nio.AsyncClient):
|
||||
|
||||
last_event_date = last_event_date,
|
||||
|
||||
unreads = room.unread_notifications,
|
||||
highlights = room.unread_highlights,
|
||||
local_unreads = local_unreads,
|
||||
local_highlights = local_highlights,
|
||||
unreads = room.unread_notifications,
|
||||
highlights = room.unread_highlights,
|
||||
local_unreads = local_unreads,
|
||||
|
||||
lexical_sorting = self.backend.settings.RoomList.lexical_sort,
|
||||
bookmarked = room.room_id in bookmarks.get(self.user_id, []),
|
||||
@@ -2272,10 +2264,7 @@ class MatrixClient(nio.AsyncClient):
|
||||
self.previous_server_unreads[room.room_id] = room_item.unreads
|
||||
self.previous_server_highlights[room.room_id] = room_item.highlights
|
||||
|
||||
if highlight:
|
||||
room_item.set_fields(local_unreads=True, local_highlights=True)
|
||||
else:
|
||||
room_item.local_unreads = True
|
||||
room_item.local_unreads = True
|
||||
|
||||
if unread or highlight:
|
||||
members = self.models[self.user_id, room.room_id, "members"]
|
||||
|
@@ -69,7 +69,6 @@ class Account(ModelItem):
|
||||
total_unread: int = 0
|
||||
total_highlights: int = 0
|
||||
local_unreads: bool = False
|
||||
local_highlights: bool = False
|
||||
|
||||
# For some reason, Account cannot inherit Presence, because QML keeps
|
||||
# complaining type error on unknown file
|
||||
@@ -165,10 +164,9 @@ class Room(ModelItem):
|
||||
|
||||
last_event_date: datetime = ZERO_DATE
|
||||
|
||||
unreads: int = 0
|
||||
highlights: int = 0
|
||||
local_unreads: bool = False
|
||||
local_highlights: bool = False
|
||||
unreads: int = 0
|
||||
highlights: int = 0
|
||||
local_unreads: bool = False
|
||||
|
||||
lexical_sorting: bool = False
|
||||
bookmarked: bool = False
|
||||
@@ -207,7 +205,6 @@ class Room(ModelItem):
|
||||
self.left,
|
||||
bool(other.inviter_id),
|
||||
bool(other.highlights),
|
||||
bool(other.local_highlights),
|
||||
bool(other.unreads),
|
||||
bool(other.local_unreads),
|
||||
other.last_event_date,
|
||||
@@ -220,7 +217,6 @@ class Room(ModelItem):
|
||||
other.left,
|
||||
bool(self.inviter_id),
|
||||
bool(self.highlights),
|
||||
bool(self.local_highlights),
|
||||
bool(self.unreads),
|
||||
bool(self.local_unreads),
|
||||
self.last_event_date,
|
||||
@@ -264,7 +260,6 @@ class AccountOrRoom(Account, Room):
|
||||
self.left,
|
||||
bool(other.inviter_id),
|
||||
bool(other.highlights),
|
||||
bool(other.local_highlights),
|
||||
bool(other.unreads),
|
||||
bool(other.local_unreads),
|
||||
other.last_event_date,
|
||||
@@ -279,7 +274,6 @@ class AccountOrRoom(Account, Room):
|
||||
other.left,
|
||||
bool(self.inviter_id),
|
||||
bool(self.highlights),
|
||||
bool(self.local_highlights),
|
||||
bool(self.unreads),
|
||||
bool(self.local_unreads),
|
||||
self.last_event_date,
|
||||
|
Reference in New Issue
Block a user