fixup! feat(federation): support /make_join and /send_join for restricted rooms

check event is join membership

Co-Authored-By: Matthias Ahouansou <matthias@ahouansou.cz>
This commit is contained in:
strawberry 2024-07-01 20:01:37 +01:00 committed by Matthias Ahouansou
parent 3a8ed99246
commit 4a6805a517
No known key found for this signature in database

View file

@ -1705,6 +1705,13 @@ async fn create_join_event(
) )
.map_err(|_| Error::BadRequest(ErrorKind::BadJson, "Invalid event content"))?; .map_err(|_| Error::BadRequest(ErrorKind::BadJson, "Invalid event content"))?;
if event_content.membership != MembershipState::Join {
return Err(Error::BadRequest(
ErrorKind::BadJson,
"Membership of sent event does not match that of the endpoint",
));
}
if event_content if event_content
.join_authorized_via_users_server .join_authorized_via_users_server
.map(|user| user.server_name() == services().globals.server_name()) .map(|user| user.server_name() == services().globals.server_name())