extend room banning to local+remote room invites

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-03-02 21:49:04 -05:00 committed by June
parent ea66bff46b
commit 34e8fd38cf
3 changed files with 34 additions and 1 deletions

View file

@ -1852,6 +1852,7 @@ pub async fn create_invite_route(
"This server does not allow room invites.",
));
}
services()
.rooms
.event_handler
@ -1921,6 +1922,17 @@ pub async fn create_invite_route(
)
.map_err(|_| Error::BadRequest(ErrorKind::InvalidParam, "state_key is not a user id."))?;
if services().rooms.metadata.is_banned(&body.room_id)? && !services().users.is_admin(&invited_user)? {
info!(
"Received remote invite from server {} for room {} and for user {invited_user}, but room is banned by us.",
&sender_servername, &body.room_id
);
return Err(Error::BadRequest(
ErrorKind::Forbidden,
"This room is banned on this homeserver.",
));
}
let mut invite_state = body.invite_room_state.clone();
let mut event: JsonObject = serde_json::from_str(body.event.get())