Remove environment guards (#7741)

Release Notes:

- N/A
This commit is contained in:
Conrad Irwin 2024-02-13 13:20:14 -07:00 committed by GitHub
parent d744aa896f
commit a2144faf9c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 22 additions and 157 deletions

View file

@ -103,7 +103,6 @@ impl Database {
channel_id: ChannelId,
user_id: UserId,
connection: ConnectionId,
environment: &str,
) -> Result<(JoinRoom, Option<MembershipUpdated>, ChannelRole)> {
self.transaction(move |tx| async move {
let channel = self.get_channel_internal(channel_id, &*tx).await?;
@ -163,7 +162,7 @@ impl Database {
let live_kit_room = format!("channel-{}", nanoid::nanoid!(30));
let room_id = self
.get_or_create_channel_room(channel_id, &live_kit_room, environment, &*tx)
.get_or_create_channel_room(channel_id, &live_kit_room, &*tx)
.await?;
self.join_channel_room_internal(room_id, user_id, connection, role, &*tx)
@ -933,7 +932,6 @@ impl Database {
&self,
channel_id: ChannelId,
live_kit_room: &str,
environment: &str,
tx: &DatabaseTransaction,
) -> Result<RoomId> {
let room = room::Entity::find()
@ -942,19 +940,11 @@ impl Database {
.await?;
let room_id = if let Some(room) = room {
if let Some(env) = room.environment {
if &env != environment {
Err(ErrorCode::WrongReleaseChannel
.with_tag("required", &env)
.anyhow())?;
}
}
room.id
} else {
let result = room::Entity::insert(room::ActiveModel {
channel_id: ActiveValue::Set(Some(channel_id)),
live_kit_room: ActiveValue::Set(live_kit_room.to_string()),
environment: ActiveValue::Set(Some(environment.to_string())),
..Default::default()
})
.exec(&*tx)