summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2024-08-09 10:50:47 +0100
committerErik Johnston <erik@matrix.org>2024-08-09 10:50:47 +0100
commit90d4e2fe276cae892ece180e8da68e78e0256e78 (patch)
treedb82d0357d3b65cb8dfe4120367dd917831c6f12
parentMerge remote-tracking branch 'origin/develop' into erikj/ss_hacks (diff)
parentNewsfile (diff)
downloadsynapse-github/erikj/ss_hacks.tar.xz
Merge branch 'erikj/ss_unread_counts' into erikj/ss_hacks github/erikj/ss_hacks erikj/ss_hacks
-rw-r--r--changelog.d/17546.misc1
-rw-r--r--synapse/handlers/sliding_sync.py13
2 files changed, 9 insertions, 5 deletions
diff --git a/changelog.d/17546.misc b/changelog.d/17546.misc
new file mode 100644
index 0000000000..a06d6a2262
--- /dev/null
+++ b/changelog.d/17546.misc
@@ -0,0 +1 @@
+Return correct per-room notification and highlight counts in experimental sliding sync implementation.
diff --git a/synapse/handlers/sliding_sync.py b/synapse/handlers/sliding_sync.py
index a702922288..531089c279 100644
--- a/synapse/handlers/sliding_sync.py
+++ b/synapse/handlers/sliding_sync.py
@@ -2395,6 +2395,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,
@@ -2415,11 +2420,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