diff --git a/changelog.d/13830.bugfix b/changelog.d/13830.bugfix new file mode 100644 index 000000000000..afce8e57e321 --- /dev/null +++ b/changelog.d/13830.bugfix @@ -0,0 +1 @@ +typing: check origin server of typing event against servers currently in the room. We also use a method that do not block on partial state so the transaction doesn't get stuck during a fast join. diff --git a/synapse/handlers/typing.py b/synapse/handlers/typing.py index 0d8466af11d4..148bb317613d 100644 --- a/synapse/handlers/typing.py +++ b/synapse/handlers/typing.py @@ -362,11 +362,13 @@ async def _recv_edu(self, origin: str, content: JsonDict) -> None: ) 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 the 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