Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
workspace: Do not prompt for hanging up current call when replacing last visible project (#36697)
Piotr Osiewicz92bbcdeb7dae
diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rsindex 499e4f46190..44aa94fe61c 100644--- a/crates/workspace/src/workspace.rs+++ b/crates/workspace/src/workspace.rs@@ -2249,27 +2249,43 @@ impl Workspace {})?;if let Some(active_call) = active_call- && close_intent != CloseIntent::Quit&& workspace_count == 1&& active_call.read_with(cx, |call, _| call.room().is_some())?{- let answer = cx.update(|window, cx| {- window.prompt(- PromptLevel::Warning,- "Do you want to leave the current call?",- None,- &["Close window and hang up", "Cancel"],- cx,- )- })?;+ if close_intent == CloseIntent::CloseWindow {+ let answer = cx.update(|window, cx| {+ window.prompt(+ PromptLevel::Warning,+ "Do you want to leave the current call?",+ None,+ &["Close window and hang up", "Cancel"],+ cx,+ )+ })?;- if answer.await.log_err() == Some(1) {- return anyhow::Ok(false);- } else {- active_call- .update(cx, |call, cx| call.hang_up(cx))?- .await- .log_err();+ if answer.await.log_err() == Some(1) {+ return anyhow::Ok(false);+ } else {+ active_call+ .update(cx, |call, cx| call.hang_up(cx))?+ .await+ .log_err();+ }+ }+ if close_intent == CloseIntent::ReplaceWindow {+ _ = active_call.update(cx, |this, cx| {+ let workspace = cx+ .windows()+ .iter()+ .filter_map(|window| window.downcast::<Workspace>())+ .next()+ .unwrap();+ let project = workspace.read(cx)?.project.clone();+ if project.read(cx).is_shared() {+ this.unshare_project(project, cx)?;+ }+ Ok::<_, anyhow::Error>(())+ })?;}}