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
This commit is contained in:
parent
9487fffc55
commit
78fea0dd8e
1 changed files with 6 additions and 4 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue