Skip to content

Commit

Permalink
Defer is_staff check for the project_diff::Deploy action (#21582)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
SomeoneToIgnore authored Dec 5, 2024
1 parent 9487fff commit 78fea0d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions crates/editor/src/git/project_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 78fea0d

Please sign in to comment.