feat(webhook): do not process actions in test run

This commit is contained in:
Ali BARIN
2022-12-08 10:40:05 +01:00
parent f79245d24a
commit 51ccdf3577

View File

@@ -13,12 +13,13 @@ export default async (request: IRequest, response: Response) => {
.findById(request.params.flowId) .findById(request.params.flowId)
.throwIfNotFound(); .throwIfNotFound();
const testRun = !flow.active;
const triggerStep = await flow.getTriggerStep(); const triggerStep = await flow.getTriggerStep();
const triggerCommand = await triggerStep.getTriggerCommand(); const triggerCommand = await triggerStep.getTriggerCommand();
const app = await triggerStep.getApp(); const app = await triggerStep.getApp();
const isWebhookApp = app.key === 'webhook'; const isWebhookApp = app.key === 'webhook';
if (!flow.active && !isWebhookApp) { if (testRun && !isWebhookApp) {
return response.sendStatus(404); return response.sendStatus(404);
} }
@@ -66,9 +67,13 @@ export default async (request: IRequest, response: Response) => {
flowId: flow.id, flowId: flow.id,
stepId: triggerStep.id, stepId: triggerStep.id,
triggerItem, triggerItem,
testRun: !flow.active testRun
}); });
if (testRun) {
return response.sendStatus(200);
}
const nextStep = await triggerStep.getNextStep(); const nextStep = await triggerStep.getNextStep();
const jobName = `${executionId}-${nextStep.id}`; const jobName = `${executionId}-${nextStep.id}`;