diff options
author | Mathieu Velten <mathieuv@matrix.org> | 2022-09-26 17:33:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-26 17:33:32 +0200 |
commit | 41461fd4d63e55d1812f0688ca58a88e7200a1d7 (patch) | |
tree | b7e9300d08b8725a05aad841822e354ba3a562fb /synapse/handlers | |
parent | Simplify cache invalidation after event persist txn (#13796) (diff) | |
download | synapse-41461fd4d63e55d1812f0688ca58a88e7200a1d7.tar.xz |
typing: check origin server of typing event against room's servers (#13830)
This is also using the partial state approximation if needed so we do not block here during a fast join. Signed-off-by: Mathieu Velten <mathieuv@matrix.org> Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com>
Diffstat (limited to 'synapse/handlers')
-rw-r--r-- | synapse/handlers/typing.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/synapse/handlers/typing.py b/synapse/handlers/typing.py index 0d8466af11..f953691669 100644 --- a/synapse/handlers/typing.py +++ b/synapse/handlers/typing.py @@ -362,11 +362,14 @@ class TypingWriterHandler(FollowerTypingHandler): ) return - domains = await self._storage_controllers.state.get_current_hosts_in_room( + # Let's check that the origin server is in the room before accepting the typing + # event. We don't want to block waiting on a partial state so take an + # approximation if needed. + domains = await self._storage_controllers.state.get_current_hosts_in_room_or_partial_state_approximation( room_id ) - if self.server_name in domains: + if user.domain in domains: logger.info("Got typing update from %s: %r", user_id, content) now = self.clock.time_msec() self._member_typing_until[member] = now + FEDERATION_TIMEOUT |