diff --git a/src/controllers/calls_controller.rs b/src/controllers/calls_controller.rs index c67828c..b1b062a 100644 --- a/src/controllers/calls_controller.rs +++ b/src/controllers/calls_controller.rs @@ -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)?; + } + } + _ => {} } diff --git a/src/controllers/conversations_controller.rs b/src/controllers/conversations_controller.rs index 4fd22d6..5af9f36 100644 --- a/src/controllers/conversations_controller.rs +++ b/src/controllers/conversations_controller.rs @@ -517,7 +517,7 @@ pub fn handle_event(e: &events_helper::Event) -> Res { None:: _>, )?; - // Disconnected users + // Disconnect users from conversation user_ws_controller::foreach_connection(|f| { if f.user_id() == user_id && f.conversations.contains(conv_id) { f.clone().replace(|w| {