summary refs log tree commit diff
path: root/synapse/handlers/room_member_worker.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Implement locally rescinding a federated knockAndrew Morgan2020-11-131-1/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Federation: make_knock and send_knock implementationsAndrew Morgan2020-11-131-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | Most of this is explained in the linked MSC (and don't miss the sequence diagram in the MSC comments), but roughly knocking takes inspiration from room joins and room invites. This commit is the room join stuff. First the knocking homeserver POSTs to the make_knock endpoint on another homeserver. The other homeserver will send back a knock event that is valid for the knocking user and the room that they are knocking on. The knocking homeserver will sign the event and send it back, before the other homeserver takes that event and then sends it into the room on the knocking homeserver's behalf. It's worth noting that the accepting/rejecting knocks all happen over existing room invite/leave flows. A homeserver rescinding its knock as well is also just sending a leave. Once the event has been inserted into the room, the homeserver that's in the room will send back a 200 and an empty JSON dict to confirm everything went well to the knocker. In a future commit, this dict will instead be filled with some stripped state events from the room which the knocking homeserver will pass back to the knocking user. And yes, the logging statements in this commit are intentional. They're consistent with the rest of the file :)
* Simplify super() calls to Python 3 syntax. (#8344)Patrick Cloke2020-09-181-1/+1
| | | | | | | This converts calls like super(Foo, self) -> super(). Generated with: sed -i "" -Ee 's/super\([^\(]+\)/super()/g' **/*.py
* Remove some unused distributor signals (#8216)Patrick Cloke2020-09-091-9/+0
| | | | | Removes the `user_joined_room` and stops calling it since there are no observers. Also cleans-up some other unused signals and related code.
* `update_membership` declaration: now always returns an event id. (#7809)Richard van der Hoff2020-07-091-1/+1
|
* Generate real events when we reject invites (#7804)Richard van der Hoff2020-07-091-8/+9
| | | | | | | | Fixes #2181. The basic premise is that, when we fail to reject an invite via the remote server, we can generate our own out-of-band leave event and persist it as an outlier, so that we have something to send to the client.
* Add ability to wait for replication streams (#7542)Erik Johnston2020-05-221-5/+6
| | | | | | | The idea here is that if an instance persists an event via the replication HTTP API it can return before we receive that event over replication, which can lead to races where code assumes that persisting an event immediately updates various caches (e.g. current state of the room). Most of Synapse doesn't hit such races, so we don't do the waiting automagically, instead we do so where necessary to avoid unnecessary delays. We may decide to change our minds here if it turns out there are a lot of subtle races going on. People probably want to look at this commit by commit.
* Add type hints to room member handlers (#7513)Patrick Cloke2020-05-151-7/+21
|
* Update the room member handler to use async/await. (#7507)Patrick Cloke2020-05-151-12/+9
|
* Propagate reason in remotely rejected invitesErik Johnston2019-11-281-1/+4
|
* Replace returnValue with return (#5736)Amber Brown2019-07-231-1/+1
|
* Remove support for invite_3pid_guest. (#5625)Richard van der Hoff2019-07-051-12/+0
| | | | | | | | | This has never been documented, and I'm not sure it's ever been used outside sytest. It's quite a lot of poorly-maintained code, so I'd like to get rid of it. For now I haven't removed the database table; I suggest we leave that for a future clearout.
* Run Black. (#5482)Amber Brown2019-06-201-6/+2
|
* Use new helper base class for membership requestsErik Johnston2018-07-311-24/+17
|
* run isortAmber Brown2018-07-091-2/+3
|
* s/join/joined/ in notify_user_membership_changeErik Johnston2018-03-141-1/+1
|
* Split RoomMemberWorkerHandler to separate fileErik Johnston2018-03-141-0/+102