Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

typing: check origin server of typing event against room's servers #13830

Merged
merged 4 commits into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/13830.bugfix
Original file line number Diff line number Diff line change
@@ -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.
MatMaul marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 4 additions & 2 deletions synapse/handlers/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
MatMaul marked this conversation as resolved.
Show resolved Hide resolved
domains = await self._storage_controllers.state.get_current_hosts_in_room_or_partial_state_approximation(
room_id
)

if self.server_name in domains:
MatMaul marked this conversation as resolved.
Show resolved Hide resolved
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
Expand Down