Prevent renaming row actions
This commit is contained in:
parent
d01bd54fd1
commit
703e2c1873
|
@ -1,4 +1,9 @@
|
||||||
import { Automation, Webhook, WebhookActionType } from "@budibase/types"
|
import {
|
||||||
|
Automation,
|
||||||
|
AutomationTriggerStepId,
|
||||||
|
Webhook,
|
||||||
|
WebhookActionType,
|
||||||
|
} from "@budibase/types"
|
||||||
import { generateAutomationID, getAutomationParams } from "../../../db/utils"
|
import { generateAutomationID, getAutomationParams } from "../../../db/utils"
|
||||||
import { deleteEntityMetadata } from "../../../utilities"
|
import { deleteEntityMetadata } from "../../../utilities"
|
||||||
import { MetadataTypes } from "../../../constants"
|
import { MetadataTypes } from "../../../constants"
|
||||||
|
@ -117,7 +122,6 @@ export async function create(automation: Automation) {
|
||||||
|
|
||||||
export async function update(automation: Automation) {
|
export async function update(automation: Automation) {
|
||||||
automation = { ...automation }
|
automation = { ...automation }
|
||||||
|
|
||||||
if (!automation._id || !automation._rev) {
|
if (!automation._id || !automation._rev) {
|
||||||
throw new HTTPError("_id or _rev fields missing", 400)
|
throw new HTTPError("_id or _rev fields missing", 400)
|
||||||
}
|
}
|
||||||
|
@ -281,4 +285,14 @@ function guardInvalidUpdatesAndThrow(
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isRowAction(automation) && automation.name !== oldAutomation.name) {
|
||||||
|
throw new Error("Row actions cannot be renamed")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function isRowAction(automation: Automation) {
|
||||||
|
const result =
|
||||||
|
automation.definition.trigger.stepId === AutomationTriggerStepId.ROW_ACTION
|
||||||
|
return result
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue