Better logic/reasoning

This commit is contained in:
Eric Eastwood committed 2026-05-21 19:00:24 -05:00
1 parent 92d0d8bdac
commit 76b4905198
1 file changed
+7 -3
+7 -3
View File
@@ -1155,12 +1155,16 @@ class FederationHandler:
# > server MAY respond to invites with a `400 M_MISSING_PARAM` standard Matrix
# > error (new to the endpoint). For invites to room version 12+ rooms, servers
# > SHOULD rather than MAY respond to such requests with `400 M_MISSING_PARAM`.
#
# FIXME: Always validate for all room versions after 2027-01-01. Given Synapse
# claimed to support room version 12 but didn't adhere to this behavior until
# 2026-05-04, we will skip for now.
invite_room_state = event.unsigned.get("invite_room_state")
if invite_room_state is not None and room_version.msc4311_stripped_state:
if room_version.msc4311_stripped_state:
try:
# Scrutinize JSON values
assert isinstance(invite_room_state, list), (
"`invite_room_state` must be a list of PDU's"
"`invite_room_state` must be a list of PDU's that includes the `m.room.create` event"
)
includes_create_event = False
for raw_stripped_event in invite_room_state:
@@ -1205,7 +1209,7 @@ class FederationHandler:
# With MSC4311: `invite_room_state` over federation can use full PDUs so we need
# to convert them into "stripped state events" so they don't end up being sent
# down to the client.
# down to the client as full PDU's.
#
# We do this separate from the validation above as sending full PDU's can happen
# in any room version.