Include room_id in CallCanceled message

This ensures we don't accidentally cancel old calls.
This commit is contained in:
Antonio Scandurra 2022-12-13 11:43:09 +01:00
parent e2b132ef23
commit 0220d7ba5d
4 changed files with 47 additions and 14 deletions

View file

@ -94,12 +94,18 @@ impl ActiveCall {
async fn handle_call_canceled(
this: ModelHandle<Self>,
_: TypedEnvelope<proto::CallCanceled>,
envelope: TypedEnvelope<proto::CallCanceled>,
_: Arc<Client>,
mut cx: AsyncAppContext,
) -> Result<()> {
this.update(&mut cx, |this, _| {
*this.incoming_call.0.borrow_mut() = None;
let mut incoming_call = this.incoming_call.0.borrow_mut();
if incoming_call
.as_ref()
.map_or(false, |call| call.room_id == envelope.payload.room_id)
{
incoming_call.take();
}
});
Ok(())
}