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))
|