Remove `LeaveCall` internal action

Antonio Scandurra created

Change summary

crates/collab_ui/src/collab_titlebar_item.rs | 13 -------------
crates/collab_ui/src/contact_list.rs         |  7 +++++--
2 files changed, 5 insertions(+), 15 deletions(-)

Detailed changes

crates/collab_ui/src/collab_titlebar_item.rs 🔗

@@ -13,7 +13,6 @@ use gpui::{
     color::Color,
     elements::*,
     geometry::{rect::RectF, vector::vec2f, PathBuilder},
-    impl_internal_actions,
     json::{self, ToJson},
     platform::{CursorStyle, MouseButton},
     AppContext, Entity, ImageData, ModelHandle, SceneBuilder, Subscription, View, ViewContext,
@@ -36,17 +35,11 @@ actions!(
     ]
 );
 
-impl_internal_actions!(collab, [LeaveCall]);
-
-#[derive(Copy, Clone, PartialEq)]
-pub(crate) struct LeaveCall;
-
 pub fn init(cx: &mut AppContext) {
     cx.add_action(CollabTitlebarItem::toggle_collaborator_list_popover);
     cx.add_action(CollabTitlebarItem::toggle_contacts_popover);
     cx.add_action(CollabTitlebarItem::share_project);
     cx.add_action(CollabTitlebarItem::unshare_project);
-    cx.add_action(CollabTitlebarItem::leave_call);
     cx.add_action(CollabTitlebarItem::toggle_user_menu);
 }
 
@@ -319,12 +312,6 @@ impl CollabTitlebarItem {
         });
     }
 
-    fn leave_call(&mut self, _: &LeaveCall, cx: &mut ViewContext<Self>) {
-        ActiveCall::global(cx)
-            .update(cx, |call, cx| call.hang_up(cx))
-            .detach_and_log_err(cx);
-    }
-
     fn render_toggle_contacts_button(
         &self,
         theme: &Theme,

crates/collab_ui/src/contact_list.rs 🔗

@@ -1,4 +1,3 @@
-use super::collab_titlebar_item::LeaveCall;
 use crate::contacts_popover;
 use call::ActiveCall;
 use client::{proto::PeerId, Contact, User, UserStore};
@@ -1002,7 +1001,11 @@ impl ContactList {
                         .contained()
                         .with_style(style.container)
                 })
-                .on_click(MouseButton::Left, |_, _, cx| cx.dispatch_action(LeaveCall))
+                .on_click(MouseButton::Left, |_, _, cx| {
+                    ActiveCall::global(cx)
+                        .update(cx, |call, cx| call.hang_up(cx))
+                        .detach_and_log_err(cx);
+                })
                 .aligned(),
             )
         } else {