diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2021-12-21 08:25:34 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-21 13:25:34 +0000 |
commit | b6102230a7391d1acaa50cc6c389813f7e0fab84 (patch) | |
tree | 605757fe7627d00ea873fb7a69f63128fbe53432 /synapse/handlers | |
parent | Various opentracing enhancements (#11619) (diff) | |
download | synapse-b6102230a7391d1acaa50cc6c389813f7e0fab84.tar.xz |
Add type hints to event_push_actions. (#11594)
Diffstat (limited to 'synapse/handlers')
-rw-r--r-- | synapse/handlers/sync.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py index d24124d6ac..7baf3f199c 100644 --- a/synapse/handlers/sync.py +++ b/synapse/handlers/sync.py @@ -36,6 +36,7 @@ from synapse.events import EventBase from synapse.logging.context import current_context from synapse.logging.opentracing import SynapseTags, log_kv, set_tag, start_active_span from synapse.push.clientformat import format_push_rules_for_user +from synapse.storage.databases.main.event_push_actions import NotifCounts from synapse.storage.roommember import MemberSummary from synapse.storage.state import StateFilter from synapse.types import ( @@ -1041,7 +1042,7 @@ class SyncHandler: async def unread_notifs_for_room_id( self, room_id: str, sync_config: SyncConfig - ) -> Dict[str, int]: + ) -> NotifCounts: with Measure(self.clock, "unread_notifs_for_room_id"): last_unread_event_id = await self.store.get_last_receipt_event_id_for_user( user_id=sync_config.user.to_string(), @@ -1049,10 +1050,9 @@ class SyncHandler: receipt_type=ReceiptTypes.READ, ) - notifs = await self.store.get_unread_event_push_actions_by_room_for_user( + return await self.store.get_unread_event_push_actions_by_room_for_user( room_id, sync_config.user.to_string(), last_unread_event_id ) - return notifs async def generate_sync_result( self, @@ -2174,10 +2174,10 @@ class SyncHandler: if room_sync or always_include: notifs = await self.unread_notifs_for_room_id(room_id, sync_config) - unread_notifications["notification_count"] = notifs["notify_count"] - unread_notifications["highlight_count"] = notifs["highlight_count"] + unread_notifications["notification_count"] = notifs.notify_count + unread_notifications["highlight_count"] = notifs.highlight_count - room_sync.unread_count = notifs["unread_count"] + room_sync.unread_count = notifs.unread_count sync_result_builder.joined.append(room_sync) |