pass room version into FederationHandler.on_invite_request (#6805)

This commit is contained in:
Richard van der Hoff 2020-01-30 22:13:02 +00:00 committed by GitHub
parent e0992fcc5b
commit 46a446828d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

1
changelog.d/6805.misc Normal file
View File

@ -0,0 +1 @@
Refactoring work in preparation for changing the event redaction algorithm.

View File

@ -410,7 +410,7 @@ class FederationServer(FederationBase):
origin_host, _ = parse_server_name(origin) origin_host, _ = parse_server_name(origin)
await self.check_server_matches_acl(origin_host, pdu.room_id) await self.check_server_matches_acl(origin_host, pdu.room_id)
pdu = await self._check_sigs_and_hash(room_version, pdu) pdu = await self._check_sigs_and_hash(room_version, pdu)
ret_pdu = await self.handler.on_invite_request(origin, pdu) ret_pdu = await self.handler.on_invite_request(origin, pdu, room_version)
time_now = self._clock.time_msec() time_now = self._clock.time_msec()
return {"event": ret_pdu.get_pdu_json(time_now)} return {"event": ret_pdu.get_pdu_json(time_now)}

View File

@ -1482,13 +1482,13 @@ class FederationHandler(BaseHandler):
return {"state": list(state.values()), "auth_chain": auth_chain} return {"state": list(state.values()), "auth_chain": auth_chain}
@defer.inlineCallbacks @defer.inlineCallbacks
def on_invite_request(self, origin, pdu): def on_invite_request(
self, origin: str, event: EventBase, room_version: RoomVersion
):
""" We've got an invite event. Process and persist it. Sign it. """ We've got an invite event. Process and persist it. Sign it.
Respond with the now signed event. Respond with the now signed event.
""" """
event = pdu
if event.state_key is None: if event.state_key is None:
raise SynapseError(400, "The invite event did not have a state key") raise SynapseError(400, "The invite event did not have a state key")