From 78fea0dd8ef4d84ad6a287f4a1fd40a4fbcb4966 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Thu, 5 Dec 2024 11:55:06 +0200 Subject: [PATCH] Defer is_staff check for the project_diff::Deploy action (#21582) During workspace registration, it's too early to check for the `is_staff` flag due to no connection being established yet. As a compromise, allow the action to appear and be registered, but do nothing for non-staff users. Release Notes: - N/A --- crates/editor/src/git/project_diff.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/editor/src/git/project_diff.rs b/crates/editor/src/git/project_diff.rs index 2c60ae4204d4d8456482eab014c153c30bc650a4..e3d9f6abd6af63d617d448676d325a0aaabfad24 100644 --- a/crates/editor/src/git/project_diff.rs +++ b/crates/editor/src/git/project_diff.rs @@ -62,13 +62,15 @@ struct Changes { } impl ProjectDiffEditor { - fn register(workspace: &mut Workspace, cx: &mut ViewContext) { - if cx.is_staff() { - workspace.register_action(Self::deploy); - } + fn register(workspace: &mut Workspace, _: &mut ViewContext) { + workspace.register_action(Self::deploy); } fn deploy(workspace: &mut Workspace, _: &Deploy, cx: &mut ViewContext) { + if !cx.is_staff() { + return; + } + if let Some(existing) = workspace.item_of_type::(cx) { workspace.activate_item(&existing, true, true, cx); } else {