From d9029da533b97c46ee117e1dd724b7db8bb62b89 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 23 Jul 2024 10:28:57 +0200 Subject: [PATCH] Don't allow deleting row action automations --- packages/server/src/api/controllers/automation.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/server/src/api/controllers/automation.ts b/packages/server/src/api/controllers/automation.ts index 6d1f3125fd..673359699a 100644 --- a/packages/server/src/api/controllers/automation.ts +++ b/packages/server/src/api/controllers/automation.ts @@ -12,6 +12,7 @@ import { UserCtx, DeleteAutomationResponse, FetchAutomationResponse, + AutomationTriggerStepId, } from "@budibase/types" import { getActionDefinitions as actionDefs } from "../../automations/actions" import sdk from "../../sdk" @@ -94,6 +95,13 @@ export async function find(ctx: UserCtx) { export async function destroy(ctx: UserCtx) { const automationId = ctx.params.id + const automation = await sdk.automations.get(ctx.params.id) + if ( + automation.definition.trigger.stepId === AutomationTriggerStepId.ROW_ACTION + ) { + ctx.throw("Row actions cannot be renamed", 403) + } + ctx.body = await sdk.automations.remove(automationId, ctx.params.rev) builderSocket?.emitAutomationDeletion(ctx, automationId) }