check if room ID already exists instead of erroring on auth check
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
8754f0e2a5
commit
7eff572e77
1 changed files with 8 additions and 0 deletions
|
@ -92,6 +92,14 @@ pub async fn create_room_route(
|
||||||
room_id = RoomId::new(services().globals.server_name())
|
room_id = RoomId::new(services().globals.server_name())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check if room ID doesn't already exist instead of erroring on auth check
|
||||||
|
if services().rooms.short.get_shortroomid(&room_id)?.is_some() {
|
||||||
|
return Err(Error::BadRequest(
|
||||||
|
ErrorKind::RoomInUse,
|
||||||
|
"Room with that custom room ID already exists",
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
services().rooms.short.get_or_create_shortroomid(&room_id)?;
|
services().rooms.short.get_or_create_shortroomid(&room_id)?;
|
||||||
|
|
||||||
let mutex_state = Arc::clone(
|
let mutex_state = Arc::clone(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue