Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Defer is_staff check for the project_diff::Deploy action (#21582)

Kirill Bulatov78fea0dd8ef4
diff --git a/crates/editor/src/git/project_diff.rs b/crates/editor/src/git/project_diff.rs
index 2c60ae4204d..e3d9f6abd6a 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<Workspace>) {
- if cx.is_staff() {
- workspace.register_action(Self::deploy);
- }
+ fn register(workspace: &mut Workspace, _: &mut ViewContext<Workspace>) {
+ workspace.register_action(Self::deploy);
}
fn deploy(workspace: &mut Workspace, _: &Deploy, cx: &mut ViewContext<Workspace>) {
+ if !cx.is_staff() {
+ return;
+ }
+
if let Some(existing) = workspace.item_of_type::<Self>(cx) {
workspace.activate_item(&existing, true, true, cx);
} else {