@@ -1953,16 +1953,31 @@ async def on_send_membership_event(
1953
1953
self , origin : str , event : EventBase
1954
1954
) -> EventContext :
1955
1955
"""
1956
- We have received a join/leave/knock event for a room.
1956
+ We have received a join/leave/knock event for a room via send_join/leave/knock .
1957
1957
1958
1958
Verify that event and send it into the room on the remote homeserver's behalf.
1959
1959
1960
+ This is quite similar to on_receive_pdu, with the following principal
1961
+ differences:
1962
+ * only membership events are permitted (and only events with
1963
+ sender==state_key -- ie, no kicks or bans)
1964
+ * *We* send out the event on behalf of the remote server.
1965
+ * We enforce the membership restrictions of restricted rooms.
1966
+ * Rejected events result in an exception rather than being stored.
1967
+
1968
+ There are also other differences, however it is not clear if these are by
1969
+ design or omission. In particular, we do not attempt to backfill any missing
1970
+ prev_events.
1971
+
1960
1972
Args:
1961
1973
origin: The homeserver of the remote (joining/invited/knocking) user.
1962
1974
event: The member event that has been signed by the remote homeserver.
1963
1975
1964
1976
Returns:
1965
1977
The context of the event after inserting it into the room graph.
1978
+
1979
+ Raises:
1980
+ SynapseError if the event is not accepted into the room
1966
1981
"""
1967
1982
logger .debug (
1968
1983
"on_send_membership_event: Got event: %s, signatures: %s" ,
@@ -1981,7 +1996,7 @@ async def on_send_membership_event(
1981
1996
if event .sender != event .state_key :
1982
1997
raise SynapseError (400 , "state_key and sender must match" , Codes .BAD_JSON )
1983
1998
1984
- event .internal_metadata .outlier = False
1999
+ assert not event .internal_metadata .outlier
1985
2000
1986
2001
# Send this event on behalf of the other server.
1987
2002
#
0 commit comments