Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Remove `OpenSharedScreen` internal action
Antonio Scandurra71a4bc7905d8
diff --git a/crates/collab_ui/src/contact_list.rs b/crates/collab_ui/src/contact_list.rsindex fffe90716e3..9eee6c90755 100644--- a/crates/collab_ui/src/contact_list.rs+++ b/crates/collab_ui/src/contact_list.rs@@ -19,7 +19,7 @@ use serde::Deserialize;use settings::Settings;use std::{mem, sync::Arc};use theme::IconButton;-use workspace::{OpenSharedScreen, Workspace};+use workspace::Workspace;impl_actions!(contact_list, [RemoveContact, RespondToContactRequest]);impl_internal_actions!(contact_list, [ToggleExpanded, Call]);@@ -433,7 +433,11 @@ impl ContactList {}}ContactEntry::ParticipantScreen { peer_id, .. } => {- cx.dispatch_action(OpenSharedScreen { peer_id: *peer_id });+ if let Some(workspace) = self.workspace.upgrade(cx) {+ workspace.update(cx, |workspace, cx| {+ workspace.open_shared_screen(*peer_id, cx)+ });+ }}_ => {}}@@ -899,6 +903,8 @@ impl ContactList {theme: &theme::ContactList,cx: &mut ViewContext<Self>,) -> AnyElement<Self> {+ enum OpenSharedScreen {}+let font_cache = cx.font_cache();let host_avatar_height = theme.contact_avatar@@ -979,8 +985,12 @@ impl ContactList {},).with_cursor_style(CursorStyle::PointingHand)- .on_click(MouseButton::Left, move |_, _, cx| {- cx.dispatch_action(OpenSharedScreen { peer_id });+ .on_click(MouseButton::Left, move |_, this, cx| {+ if let Some(workspace) = this.workspace.upgrade(cx) {+ workspace.update(cx, |workspace, cx| {+ workspace.open_shared_screen(peer_id, cx)+ });+ }}).into_any()}diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rsindex 3dbb94f4b89..98d8b59d4d8 100644--- a/crates/workspace/src/workspace.rs+++ b/crates/workspace/src/workspace.rs@@ -134,11 +134,6 @@ pub struct OpenPaths {#[derive(Clone, Deserialize, PartialEq)]pub struct ActivatePane(pub usize);-#[derive(Clone, PartialEq)]-pub struct OpenSharedScreen {- pub peer_id: PeerId,-}-#[derive(Clone, PartialEq)]pub struct SplitWithItem {pane_to_split: WeakViewHandle<Pane>,@@ -209,7 +204,6 @@ pub type WorkspaceId = i64;impl_internal_actions!(workspace,[- OpenSharedScreen,RemoveWorktreeFromProject,SplitWithItem,SplitWithProjectEntry,@@ -290,7 +284,6 @@ pub fn init(app_state: Arc<AppState>, cx: &mut AppContext) {cx.add_async_action(Workspace::close);cx.add_global_action(Workspace::close_global);cx.add_async_action(Workspace::save_all);- cx.add_action(Workspace::open_shared_screen);cx.add_action(Workspace::add_folder_to_project);cx.add_action(Workspace::remove_folder_from_project);cx.add_action(@@ -1606,10 +1599,8 @@ impl Workspace {item}- pub fn open_shared_screen(&mut self, action: &OpenSharedScreen, cx: &mut ViewContext<Self>) {- if let Some(shared_screen) =- self.shared_screen_for_peer(action.peer_id, &self.active_pane, cx)- {+ pub fn open_shared_screen(&mut self, peer_id: PeerId, cx: &mut ViewContext<Self>) {+ if let Some(shared_screen) = self.shared_screen_for_peer(peer_id, &self.active_pane, cx) {let pane = self.active_pane.clone();Pane::add_item(self, &pane, Box::new(shared_screen), false, true, None, cx);}