workspace: Do not prompt for hanging up current call when replacing last visible project (#36697)

This fixes a bug where in order to open a new project in a call (even if
it's not shared), you need to hang up.


Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2025-08-22 15:34:55 +02:00 committed by GitHub
parent 54df43e06f
commit 92bbcdeb7d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2249,10 +2249,10 @@ 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())?
{
if close_intent == CloseIntent::CloseWindow {
let answer = cx.update(|window, cx| {
window.prompt(
PromptLevel::Warning,
@ -2272,6 +2272,22 @@ impl Workspace {
.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>(())
})?;
}
}
let save_result = this
.update_in(cx, |this, window, cx| {