π OpenHands: AI-Driven Development
fix: show the add automation menu to org members (#17526)
Hiep Le7b4b4e15a65c
diff --git a/__tests__/routes/automations-list-behavior.test.tsx b/__tests__/routes/automations-list-behavior.test.tsxindex a90a578ec5..b111d0d06f 100644--- a/__tests__/routes/automations-list-behavior.test.tsx+++ b/__tests__/routes/automations-list-behavior.test.tsx@@ -914,17 +914,20 @@ describe("automations list interactions", () => {expect(mocks.trackExported).toHaveBeenCalledWith({ backendKind: "local" });});- it("hides create and import actions without management permission", () => {+ it("shows create and import actions without management permission", () => {+ // Arrangemocks.canManage = false;++ // Actrender(<AutomationsList />);++ // Assertexpect(- screen.queryByTestId("automations-add-automation"),- ).not.toBeInTheDocument();+ screen.getByTestId("automations-add-automation"),+ ).toBeInTheDocument();expect(- screen.queryByTestId("automations-import-automation"),- ).not.toBeInTheDocument();- expect(screen.queryByTestId("add-modal")).not.toBeInTheDocument();- expect(screen.queryByTestId("import-modal")).not.toBeInTheDocument();+ screen.getByTestId("automations-import-automation"),+ ).toBeInTheDocument();});it("opens and closes the add-automation form", async () => {diff --git a/src/hooks/use-automation-permissions.ts b/src/hooks/use-automation-permissions.tsindex d189ced0a9..68afe49eb5 100644--- a/src/hooks/use-automation-permissions.ts+++ b/src/hooks/use-automation-permissions.ts@@ -16,7 +16,7 @@ export const MANAGE_AUTOMATIONS = "manage_automations";export interface AutomationPermissionsResult {/** Read-only access (list, get, list runs, capabilities, git-sync status). */canView: boolean;- /** Full write access (create, update, delete, dispatch, git-sync config). */+ /** Full write access (update, delete, dispatch, git-sync config). */canManage: boolean;/*** `true` when permissions are still being resolved on cloud. Local alwaysdiff --git a/src/routes/automations-list.tsx b/src/routes/automations-list.tsxindex 0755aefe15..8c462946f3 100644--- a/src/routes/automations-list.tsx+++ b/src/routes/automations-list.tsx@@ -38,7 +38,6 @@ import { ImportAutomationModal } from "#/components/features/automations/import-import { RecommendedAutomationsLauncher } from "#/components/features/automations/recommended-automations-launcher";import { BrandButton } from "#/components/features/settings/brand-button";import { useTracking } from "#/hooks/use-tracking";-import { useAutomationPermissions } from "#/hooks/use-automation-permissions";import type { Automation, AutomationSpec } from "#/types/automation";import {getAutomationExportFilename,@@ -121,9 +120,6 @@ export default function AutomationsList() {const { navigate } = useNavigation();// Git Sync is only available on local backends.const isLocalBackend = active.backend.kind === "local";- // Creating an automation requires manage_automations (no owner escape hatch- // β it's a new record, not a mutation of an existing one).- const { canManage } = useAutomationPermissions();const {data: healthData,@@ -388,12 +384,10 @@ export default function AutomationsList() {{t(I18nKey.AUTOMATIONS$GIT_SYNC$NAV_BUTTON)}</BrandButton>)}- {canManage ? (- <AddAutomationMenu- onAdd={() => setIsAddAutomationOpen(true)}- onImport={() => setIsImportOpen(true)}- />- ) : null}+ <AddAutomationMenu+ onAdd={() => setIsAddAutomationOpen(true)}+ onImport={() => setIsImportOpen(true)}+ /></div></div>