summary refs log tree commit diff
path: root/synapse/handlers/typing.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2024-08-05 13:10:36 +0100
committerErik Johnston <erik@matrix.org>2024-08-05 13:10:36 +0100
commitd66e774daa455fb4b4cc1d3dc3d81af58b6f29ec (patch)
treeff879e0063d5ddf96e33f4ed5e399ce735ff2b1a /synapse/handlers/typing.py
parentMerge remote-tracking branch 'origin/develop' into erikj/ss_hacks (diff)
parentSliding Sync: Add typing notification extension (MSC3961) (#17505) (diff)
downloadsynapse-d66e774daa455fb4b4cc1d3dc3d81af58b6f29ec.tar.xz
Merge remote-tracking branch 'origin/develop' into erikj/ss_hacks
Diffstat (limited to 'synapse/handlers/typing.py')
-rw-r--r--synapse/handlers/typing.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/synapse/handlers/typing.py b/synapse/handlers/typing.py
index 4c87718337..8d693fee30 100644
--- a/synapse/handlers/typing.py
+++ b/synapse/handlers/typing.py
@@ -565,7 +565,12 @@ class TypingNotificationEventSource(EventSource[int, JsonMapping]):
         room_ids: Iterable[str],
         is_guest: bool,
         explicit_room_id: Optional[str] = None,
+        to_key: Optional[int] = None,
     ) -> Tuple[List[JsonMapping], int]:
+        """
+        Find typing notifications for given rooms (> `from_token` and <= `to_token`)
+        """
+
         with Measure(self.clock, "typing.get_new_events"):
             from_key = int(from_key)
             handler = self.get_typing_handler()
@@ -574,7 +579,9 @@ class TypingNotificationEventSource(EventSource[int, JsonMapping]):
             for room_id in room_ids:
                 if room_id not in handler._room_serials:
                     continue
-                if handler._room_serials[room_id] <= from_key:
+                if handler._room_serials[room_id] <= from_key or (
+                    to_key is not None and handler._room_serials[room_id] > to_key
+                ):
                     continue
 
                 events.append(self._make_event_for(room_id))