Don't allow deleting row action automations
This commit is contained in:
parent
d601400871
commit
d9029da533
|
@ -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<void, DeleteAutomationResponse>) {
|
||||
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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue