From e98a539433ef5f6b9d0267aba4653bf67041a07a Mon Sep 17 00:00:00 2001 From: miruka Date: Thu, 16 Apr 2020 13:10:39 -0400 Subject: [PATCH] Don't increment room unreads for past events --- src/backend/nio_callbacks.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/backend/nio_callbacks.py b/src/backend/nio_callbacks.py index 19bcdce7..de202d3a 100644 --- a/src/backend/nio_callbacks.py +++ b/src/backend/nio_callbacks.py @@ -108,14 +108,17 @@ class NioCallbacks: room, ev, content=co, mentions=mention_list, ) - if self.client.first_sync_done.is_set() and self.client.open_room != room.room_id: - room = self.client.models[self.client.user_id, "rooms"][room.room_id] + is_past = await self.client.event_is_past(ev) + + if not is_past and self.client.open_room != room.room_id: + model = self.client.models[self.client.user_id, "rooms"] + room = model[room.room_id] room.unreads += 1 + if HTML_PROCESSOR.user_id_link_in_html(co, self.client.user_id): room.mentions += 1 - async def onRoomMessageNotice(self, room, ev) -> None: await self.onRoomMessageText(room, ev)