diff --git a/src/api/client/directory.rs b/src/api/client/directory.rs index ca4c1814..1a3e717d 100644 --- a/src/api/client/directory.rs +++ b/src/api/client/directory.rs @@ -1,6 +1,6 @@ use axum::extract::State; use axum_client_ip::InsecureClientIp; -use conduit::{err, info, warn, Error, Result}; +use conduit::{err, info, warn, Err, Error, Result}; use ruma::{ api::{ client::{ @@ -124,6 +124,10 @@ pub(crate) async fn set_room_visibility_route( return Err(Error::BadRequest(ErrorKind::NotFound, "Room not found")); } + if services.users.is_deactivated(sender_user).unwrap_or(false) && body.appservice_info.is_none() { + return Err!(Request(Forbidden("Guests cannot publish to room directories"))); + } + if !user_can_publish_room(&services, sender_user, &body.room_id)? { return Err(Error::BadRequest( ErrorKind::forbidden(),