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:
parent
54df43e06f
commit
92bbcdeb7d
1 changed files with 33 additions and 17 deletions
|
@ -2249,27 +2249,43 @@ impl Workspace {
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
if let Some(active_call) = active_call
|
if let Some(active_call) = active_call
|
||||||
&& close_intent != CloseIntent::Quit
|
|
||||||
&& workspace_count == 1
|
&& workspace_count == 1
|
||||||
&& active_call.read_with(cx, |call, _| call.room().is_some())?
|
&& active_call.read_with(cx, |call, _| call.room().is_some())?
|
||||||
{
|
{
|
||||||
let answer = cx.update(|window, cx| {
|
if close_intent == CloseIntent::CloseWindow {
|
||||||
window.prompt(
|
let answer = cx.update(|window, cx| {
|
||||||
PromptLevel::Warning,
|
window.prompt(
|
||||||
"Do you want to leave the current call?",
|
PromptLevel::Warning,
|
||||||
None,
|
"Do you want to leave the current call?",
|
||||||
&["Close window and hang up", "Cancel"],
|
None,
|
||||||
cx,
|
&["Close window and hang up", "Cancel"],
|
||||||
)
|
cx,
|
||||||
})?;
|
)
|
||||||
|
})?;
|
||||||
|
|
||||||
if answer.await.log_err() == Some(1) {
|
if answer.await.log_err() == Some(1) {
|
||||||
return anyhow::Ok(false);
|
return anyhow::Ok(false);
|
||||||
} else {
|
} else {
|
||||||
active_call
|
active_call
|
||||||
.update(cx, |call, cx| call.hang_up(cx))?
|
.update(cx, |call, cx| call.hang_up(cx))?
|
||||||
.await
|
.await
|
||||||
.log_err();
|
.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>(())
|
||||||
|
})?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue