summary refs log tree commit diff
path: root/synapse/handlers/sliding_sync.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2024-08-09 10:31:51 +0100
committerErik Johnston <erik@matrix.org>2024-08-09 10:31:56 +0100
commit98b3f564118215ff2442b6d446234cb7bf27ad42 (patch)
tree09b740269836b44eb42a6482708d146f4c61fb1b /synapse/handlers/sliding_sync.py
parentSSS: Implement PREVIOUSLY room tracking (#17535) (diff)
downloadsynapse-98b3f564118215ff2442b6d446234cb7bf27ad42.tar.xz
SS: Hook up notification counts
Diffstat (limited to 'synapse/handlers/sliding_sync.py')
-rw-r--r--synapse/handlers/sliding_sync.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/synapse/handlers/sliding_sync.py b/synapse/handlers/sliding_sync.py
index 18a96843be..ac65b30290 100644
--- a/synapse/handlers/sliding_sync.py
+++ b/synapse/handlers/sliding_sync.py
@@ -2364,6 +2364,11 @@ class SlidingSyncHandler:
 
         set_tag(SynapseTags.RESULT_PREFIX + "initial", initial)
 
+        notif_counts = await self.store.get_unread_event_push_actions_by_room_for_user(
+            room_id,
+            sync_config.user.to_string(),
+        )
+
         return SlidingSyncResult.RoomResult(
             name=room_name,
             avatar=room_avatar,
@@ -2384,11 +2389,9 @@ class SlidingSyncHandler:
             invited_count=room_membership_summary.get(
                 Membership.INVITE, empty_membership_summary
             ).count,
-            # TODO: These are just dummy values. We could potentially just remove these
-            # since notifications can only really be done correctly on the client anyway
-            # (encrypted rooms).
-            notification_count=0,
-            highlight_count=0,
+            # TODO: What about notifications in threads?
+            notification_count=notif_counts.main_timeline.notify_count,
+            highlight_count=notif_counts.main_timeline.highlight_count,
         )
 
     @trace