extend room banning to local+remote room invites
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
ea66bff46b
commit
34e8fd38cf
3 changed files with 34 additions and 1 deletions
|
@ -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())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue