Don't increment room unreads for past events

This commit is contained in:
miruka 2020-04-16 13:10:39 -04:00
parent 6ee20a2717
commit e98a539433

View File

@ -108,14 +108,17 @@ class NioCallbacks:
room, ev, content=co, mentions=mention_list, room, ev, content=co, mentions=mention_list,
) )
if self.client.first_sync_done.is_set() and self.client.open_room != room.room_id: is_past = await self.client.event_is_past(ev)
room = self.client.models[self.client.user_id, "rooms"][room.room_id]
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 room.unreads += 1
if HTML_PROCESSOR.user_id_link_in_html(co, self.client.user_id): if HTML_PROCESSOR.user_id_link_in_html(co, self.client.user_id):
room.mentions += 1 room.mentions += 1
async def onRoomMessageNotice(self, room, ev) -> None: async def onRoomMessageNotice(self, room, ev) -> None:
await self.onRoomMessageText(room, ev) await self.onRoomMessageText(room, ev)