summary refs log tree commit diff
path: root/docs
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-11-12 18:35:13 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2020-11-13 16:23:00 +0000
commita2ab56a06868bd305fda5e97b2d478db5d7c73a5 (patch)
treed5923304303638f708e57eb847676cdfeb958941 /docs
parentGeneralise _locally_reject_invite (diff)
downloadsynapse-a2ab56a06868bd305fda5e97b2d478db5d7c73a5.tar.xz
Implement locally rescinding a federated knock
As mentioned in the MSC, a user can rescind (take back) a knock while it
is pending by sending a leave event to the room. This will set their
membership to leave instead of knock.

Now, this functionality already worked before this commit for rooms that
the homeserver was already in. What didn't work was:

* Rescinding a knock over federation to a room with active homeservers
* Rescinding a knock over federation to a room with inactive homeservers

This commit addresses the second bullet point, and leaves the first
bullet point as a TODO (as it is an edge case an not immediately obvious
how it would be done).

What this commit does is crib off the same functionality as locally
rejecting an invite. That occurs when we are unable to contact the
homeserver that originally sent us an invite. Instead an out-of-band
leave membership event will be generated and sent to clients locally.

The same is happening here. You can mostly ignore the new
generate_local_out_of_band_membership methods, those are just some
structural bits to allow us to call that method from RoomMemberHandler.

The real meat of this commit is moving about and adding some logic in
`update_membership_locked`, specifically for when we're updating a
user's membership to "leave". There was already some code in there to
check whether the room to send the leave to was a room the homeserver is
not currently a part of. In that case, we'd remote reject the knock.
This commit just extends that to also rescind knocks if the user's
membership in the room is currently "knock". We skip the remote attempt
for now and go straight to generating a local leave membership event.
Diffstat (limited to 'docs')
0 files changed, 0 insertions, 0 deletions