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

Commit 8beead6

Browse files
authored
Send out invite rejections and knocks over federation (#10223)
ensure that events sent via `send_leave` and `send_knock` are sent on to the rest of the federation.
1 parent 27c06a6 commit 8beead6

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

changelog.d/10223.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a long-standing bug which meant that invite rejections and knocks were not sent out over federation in a timely manner.

scripts-dev/complement.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ if [[ -n "$1" ]]; then
6565
fi
6666

6767
# Run the tests!
68-
go test -v -tags synapse_blacklist,msc2946,msc3083,msc2716 -count=1 $EXTRA_COMPLEMENT_ARGS ./tests
68+
go test -v -tags synapse_blacklist,msc2946,msc3083,msc2716,msc2403 -count=1 $EXTRA_COMPLEMENT_ARGS ./tests

synapse/handlers/federation.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1980,6 +1980,13 @@ async def on_send_leave_request(self, origin: str, pdu: EventBase) -> None:
19801980

19811981
event.internal_metadata.outlier = False
19821982

1983+
# Send this event on behalf of the other server.
1984+
#
1985+
# The remote server isn't a full participant in the room at this point, so
1986+
# may not have an up-to-date list of the other homeservers participating in
1987+
# the room, so we send it on their behalf.
1988+
event.internal_metadata.send_on_behalf_of = origin
1989+
19831990
context = await self.state_handler.compute_event_context(event)
19841991
await self._auth_and_persist_event(origin, event, context)
19851992

@@ -2084,6 +2091,13 @@ async def on_send_knock_request(
20842091

20852092
event.internal_metadata.outlier = False
20862093

2094+
# Send this event on behalf of the other server.
2095+
#
2096+
# The remote server isn't a full participant in the room at this point, so
2097+
# may not have an up-to-date list of the other homeservers participating in
2098+
# the room, so we send it on their behalf.
2099+
event.internal_metadata.send_on_behalf_of = origin
2100+
20872101
context = await self.state_handler.compute_event_context(event)
20882102

20892103
event_allowed = await self.third_party_event_rules.check_event_allowed(

0 commit comments

Comments
 (0)