1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-11-22 13:29:21 +00:00

Close call when user is removed from a conversation

This commit is contained in:
Pierre HUBERT 2021-03-07 19:36:48 +01:00
parent 0f4b7af449
commit 01015fa1e3
2 changed files with 16 additions and 1 deletions

View File

@ -447,6 +447,21 @@ pub fn handle_event(e: &events_helper::Event) -> Res {
})?; })?;
} }
// Call active call of user (if any)
Event::RemovedUserFromConversation(user_id, conv_id) => {
let mut conn = None;
user_ws_controller::foreach_connection(|f| {
if f.user_id() == user_id && f.is_having_call_with_conversation(conv_id) {
conn = Some(f.clone());
}
Ok(())
})?;
if let Some(c) = conn {
make_user_leave_call(conv_id, &c)?;
}
}
_ => {} _ => {}
} }

View File

@ -517,7 +517,7 @@ pub fn handle_event(e: &events_helper::Event) -> Res {
None::<fn(&_) -> _>, None::<fn(&_) -> _>,
)?; )?;
// Disconnected users // Disconnect users from conversation
user_ws_controller::foreach_connection(|f| { user_ws_controller::foreach_connection(|f| {
if f.user_id() == user_id && f.conversations.contains(conv_id) { if f.user_id() == user_id && f.conversations.contains(conv_id) {
f.clone().replace(|w| { f.clone().replace(|w| {