Fix prevention of cross-channel joins
Co-Authored-By: Max <max@zed.dev>
This commit is contained in:
parent
3541dd8a6d
commit
ed76315387
4 changed files with 54 additions and 42 deletions
|
@ -88,7 +88,7 @@ impl std::fmt::Display for Error {
|
|||
|
||||
impl std::error::Error for Error {}
|
||||
|
||||
#[derive(Default, Deserialize)]
|
||||
#[derive(Deserialize)]
|
||||
pub struct Config {
|
||||
pub http_port: u16,
|
||||
pub database_url: String,
|
||||
|
@ -100,7 +100,7 @@ pub struct Config {
|
|||
pub live_kit_secret: Option<String>,
|
||||
pub rust_log: Option<String>,
|
||||
pub log_json: Option<bool>,
|
||||
pub zed_environment: String,
|
||||
pub zed_environment: Arc<str>,
|
||||
}
|
||||
|
||||
#[derive(Default, Deserialize)]
|
||||
|
|
|
@ -104,6 +104,7 @@ impl<R: RequestMessage> Response<R> {
|
|||
|
||||
#[derive(Clone)]
|
||||
struct Session {
|
||||
zed_environment: Arc<str>,
|
||||
user_id: UserId,
|
||||
connection_id: ConnectionId,
|
||||
db: Arc<tokio::sync::Mutex<DbHandle>>,
|
||||
|
@ -609,6 +610,7 @@ impl Server {
|
|||
user_id,
|
||||
connection_id,
|
||||
db: Arc::new(tokio::sync::Mutex::new(DbHandle(this.app_state.db.clone()))),
|
||||
zed_environment: this.app_state.config.zed_environment.clone(),
|
||||
peer: this.peer.clone(),
|
||||
connection_pool: this.connection_pool.clone(),
|
||||
live_kit_client: this.app_state.live_kit_client.clone(),
|
||||
|
@ -999,7 +1001,7 @@ async fn join_room(
|
|||
room_id,
|
||||
session.user_id,
|
||||
session.connection_id,
|
||||
RELEASE_CHANNEL_NAME.as_str(),
|
||||
session.zed_environment.as_ref(),
|
||||
)
|
||||
.await?;
|
||||
room_updated(&room.room, &session.peer);
|
||||
|
@ -2608,7 +2610,7 @@ async fn join_channel_internal(
|
|||
channel_id,
|
||||
session.user_id,
|
||||
session.connection_id,
|
||||
RELEASE_CHANNEL_NAME.as_str(),
|
||||
session.zed_environment.as_ref(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ use crate::{
|
|||
db::{tests::TestDb, NewUserParams, UserId},
|
||||
executor::Executor,
|
||||
rpc::{Server, CLEANUP_TIMEOUT, RECONNECT_TIMEOUT},
|
||||
AppState,
|
||||
AppState, Config,
|
||||
};
|
||||
use anyhow::anyhow;
|
||||
use call::ActiveCall;
|
||||
|
@ -414,7 +414,19 @@ impl TestServer {
|
|||
Arc::new(AppState {
|
||||
db: test_db.db().clone(),
|
||||
live_kit_client: Some(Arc::new(fake_server.create_api_client())),
|
||||
config: Default::default(),
|
||||
config: Config {
|
||||
http_port: 0,
|
||||
database_url: "".into(),
|
||||
database_max_connections: 0,
|
||||
api_token: "".into(),
|
||||
invite_link_prefix: "".into(),
|
||||
live_kit_server: None,
|
||||
live_kit_key: None,
|
||||
live_kit_secret: None,
|
||||
rust_log: None,
|
||||
log_json: None,
|
||||
zed_environment: "test".into(),
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue