From 09e1942b04ddc800a62a5872e151c981a0339261 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Wed, 11 Nov 2020 18:10:40 +0000 Subject: Send stripped state events back to the knocking homeserver Here we finally send the stripped state events back to the knocking homeserver, which then ingests and stores those events. A future commit will actually start sending those events down /sync to the relevant user. --- synapse/handlers/federation.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'synapse/handlers/federation.py') diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py index c89b5d61d4..377180886f 100644 --- a/synapse/handlers/federation.py +++ b/synapse/handlers/federation.py @@ -1484,10 +1484,18 @@ class FederationHandler(BaseHandler): except ValueError: pass - # Send the signed event back to the room - await self.federation_client.send_knock(target_hosts, event) + # Send the signed event back to the room, and potentially receive some + # further information about the room in the form of partial state events + stripped_room_state = await self.federation_client.send_knock( + target_hosts, event + ) + + # Store any stripped room state events in the "unsigned" key of the event. + # This is a bit of a hack and is cribbing off of invites. Basically we + # store the room state here and retrieve it again when this event appears + # in the invitee's sync stream. It is stripped out for all other local users. + event.unsigned["knock_room_state"] = stripped_room_state["knock_state_events"] - # Store the event locally context = await self.state_handler.compute_event_context(event) stream_id = await self.persist_events_and_notify( event.room_id, [(event, context)] -- cgit 1.5.1