Prevent duplicate notifications for the same event

This commit is contained in:
miruka
2020-09-16 14:28:00 -04:00
parent 8691a8c85b
commit 4a6e2ea46a
2 changed files with 8 additions and 3 deletions

View File

@@ -2181,12 +2181,16 @@ class MatrixClient(nio.AsyncClient):
if from_us:
return item
if await self.event_is_past(ev):
already_notified = item.event_id in self.backend.notified_events
if already_notified or await self.event_is_past(ev):
await self.update_account_unread_counts()
return item
# Alerts & notifications
self.backend.notified_events.add(item.event_id)
room_item = self.models[self.user_id, "rooms"][room.room_id]
unread = \