Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Ensure declining call doesn't accidentally leave a room
Antonio Scandurrad6d1e20f07b2
diff --git a/crates/collab/src/integration_tests.rs b/crates/collab/src/integration_tests.rsindex 1e2a3e7a548..9818e295f17 100644--- a/crates/collab/src/integration_tests.rs+++ b/crates/collab/src/integration_tests.rs@@ -6612,7 +6612,7 @@ impl TestClient {.update(cx, |call, cx| call.share_project(project.clone(), cx)).await{- log::error!("{}: error sharing project {:?}", username, error);+ log::error!("{}: error sharing project, {:?}", username, error);}let buffers = client.buffers.entry(project.clone()).or_default();diff --git a/crates/collab/src/rpc/store.rs b/crates/collab/src/rpc/store.rsindex a7abce7094b..c9358ddc2a3 100644--- a/crates/collab/src/rpc/store.rs+++ b/crates/collab/src/rpc/store.rs@@ -674,8 +674,13 @@ impl Store {.connected_users.get_mut(&recipient_user_id).ok_or_else(|| anyhow!("no such connection"))?;- if let Some(active_call) = recipient.active_call.take() {+ if let Some(active_call) = recipient.active_call {anyhow::ensure!(active_call.room_id == room_id, "no such room");+ anyhow::ensure!(+ active_call.connection_id.is_none(),+ "cannot decline a call after joining room"+ );+ recipient.active_call.take();let recipient_connection_ids = self.connection_ids_for_user(recipient_user_id).collect::<Vec<_>>();@@ -1196,7 +1201,9 @@ impl Store {assert!(self.connections.contains_key(&ConnectionId(participant.peer_id)),- "room contains participant that has disconnected"+ "room {} contains participant {:?} that has disconnected",+ room_id,+ participant);for participant_project in &participant.projects {