Merge pull request #2437 from zed-industries/fix-joining-call

Fix "IncomingCallNotification was dropped" error when accepting a call
This commit is contained in:
Antonio Scandurra 2023-05-03 10:49:04 +02:00 committed by GitHub
commit 3f037e5128
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -78,24 +78,26 @@ impl IncomingCallNotification {
let join = active_call.update(cx, |active_call, cx| active_call.accept_incoming(cx)); let join = active_call.update(cx, |active_call, cx| active_call.accept_incoming(cx));
let caller_user_id = self.call.calling_user.id; let caller_user_id = self.call.calling_user.id;
let initial_project_id = self.call.initial_project.as_ref().map(|project| project.id); let initial_project_id = self.call.initial_project.as_ref().map(|project| project.id);
cx.spawn(|this, mut cx| async move { let app_state = self.app_state.clone();
join.await?; cx.app_context()
if let Some(project_id) = initial_project_id { .spawn(|mut cx| async move {
this.update(&mut cx, |this, cx| { join.await?;
if let Some(app_state) = this.app_state.upgrade() { if let Some(project_id) = initial_project_id {
workspace::join_remote_project( cx.update(|cx| {
project_id, if let Some(app_state) = app_state.upgrade() {
caller_user_id, workspace::join_remote_project(
app_state, project_id,
cx, caller_user_id,
) app_state,
.detach_and_log_err(cx); cx,
} )
})?; .detach_and_log_err(cx);
} }
anyhow::Ok(()) });
}) }
.detach_and_log_err(cx); anyhow::Ok(())
})
.detach_and_log_err(cx);
} else { } else {
active_call.update(cx, |active_call, _| { active_call.update(cx, |active_call, _| {
active_call.decline_incoming().log_err(); active_call.decline_incoming().log_err();