Add tests
This commit is contained in:
parent
5cd3b9dc88
commit
6a8d55a00c
|
@ -2,9 +2,9 @@ import { RowActionTriggerRequest, Ctx } from "@budibase/types"
|
|||
import sdk from "../../../sdk"
|
||||
|
||||
export async function run(ctx: Ctx<RowActionTriggerRequest, void>) {
|
||||
const { sourceId, actionId } = ctx.params
|
||||
const { tableId, actionId } = ctx.params
|
||||
const { rowId } = ctx.request.body
|
||||
|
||||
await sdk.rowActions.run(sourceId, actionId, rowId)
|
||||
await sdk.rowActions.run(tableId, actionId, rowId)
|
||||
ctx.status = 200
|
||||
}
|
||||
|
|
|
@ -726,6 +726,7 @@ describe("/rowsActions", () => {
|
|||
)
|
||||
).id
|
||||
|
||||
await config.publish()
|
||||
await config.api.rowAction.trigger(
|
||||
viewId,
|
||||
rowAction.id,
|
||||
|
@ -757,7 +758,8 @@ describe("/rowsActions", () => {
|
|||
rowAction.id
|
||||
)
|
||||
|
||||
await config.api.rowAction.trigger(tableId, rowAction.id, {
|
||||
await config.publish()
|
||||
await config.api.rowAction.trigger(viewId, rowAction.id, {
|
||||
rowId: row._id!,
|
||||
})
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ export function triggerRowActionAuthorised(
|
|||
const tableId = isTableId
|
||||
? sourceId
|
||||
: utils.extractViewInfoFromID(sourceId).tableId
|
||||
|
||||
const rowAction = await sdk.rowActions.get(tableId, rowActionId)
|
||||
|
||||
if (isTableId && !rowAction.permissions.table.runAllowed) {
|
||||
|
@ -37,6 +38,8 @@ export function triggerRowActionAuthorised(
|
|||
)
|
||||
}
|
||||
|
||||
// Enrich tableId
|
||||
ctx.params.tableId = tableId
|
||||
return next()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue