diff --git a/src/api/client_server/room.rs b/src/api/client_server/room.rs index 144ed131..5d7cd6c0 100644 --- a/src/api/client_server/room.rs +++ b/src/api/client_server/room.rs @@ -52,7 +52,16 @@ pub async fn create_room_route( let sender_user = body.sender_user.as_ref().expect("user is authenticated"); - let room_id = RoomId::new(services().globals.server_name()); + if !services().globals.allow_room_creation() + && !&body.from_appservice + && !services().users.is_admin(sender_user)? + { + return Err(Error::BadRequest( + ErrorKind::Forbidden, + "Room creation has been disabled.", + )); + } + services().rooms.short.get_or_create_shortroomid(&room_id)?; @@ -67,16 +76,6 @@ pub async fn create_room_route( ); let state_lock = mutex_state.lock().await; - if !services().globals.allow_room_creation() - && !body.from_appservice - && !services().users.is_admin(sender_user)? - { - return Err(Error::BadRequest( - ErrorKind::Forbidden, - "Room creation has been disabled.", - )); - } - let alias: Option = body.room_alias_name .as_ref()