removed default form complition screen

This commit is contained in:
Michael Kret 2024-10-29 13:32:21 +02:00
parent 13c047126b
commit a41937a5aa
2 changed files with 58 additions and 57 deletions

View file

@ -1,6 +1,6 @@
import axios from 'axios'; import axios from 'axios';
import type express from 'express'; import type express from 'express';
import { FORM_NODE_TYPE, NodeHelpers, sleep, Workflow } from 'n8n-workflow'; import { NodeHelpers, sleep, Workflow } from 'n8n-workflow';
import { Service } from 'typedi'; import { Service } from 'typedi';
import { ExecutionRepository } from '@/databases/repositories/execution.repository'; import { ExecutionRepository } from '@/databases/repositories/execution.repository';
@ -94,27 +94,27 @@ export class WaitingWebhooks implements IWebhookManager {
const lastNodeExecuted = execution.data.resultData.lastNodeExecuted as string; const lastNodeExecuted = execution.data.resultData.lastNodeExecuted as string;
if (execution.finished) { if (execution.finished) {
if (this.includeForms && req.method === 'GET') { // if (this.includeForms && req.method === 'GET') {
const executionWorkflowData = execution.workflowData; // const executionWorkflowData = execution.workflowData;
const hasCompletionPage = executionWorkflowData.nodes.some((node) => { // const hasCompletionPage = executionWorkflowData.nodes.some((node) => {
return ( // return (
!node.disabled && // !node.disabled &&
node.type === FORM_NODE_TYPE && // node.type === FORM_NODE_TYPE &&
node.parameters.operation === 'completion' // node.parameters.operation === 'completion'
); // );
}); // });
if (!hasCompletionPage) { // if (!hasCompletionPage) {
res.render('form-trigger-completion', { // res.render('form-trigger-completion', {
title: 'Form Submitted', // title: 'Form Submitted',
message: 'Your response has been recorded', // message: 'Your response has been recorded',
formTitle: 'Form Submitted', // formTitle: 'Form Submitted',
}); // });
return { // return {
noWebhookResponse: true, // noWebhookResponse: true,
}; // };
} // }
// const workflow = this.getWorkflow(execution); // const workflow = this.getWorkflow(execution);
@ -154,10 +154,11 @@ export class WaitingWebhooks implements IWebhookManager {
// noWebhookResponse: true, // noWebhookResponse: true,
// }; // };
// } // }
} else { // } else {
// throw new ConflictError(`The execution "${executionId} has finished already.`);
// }
throw new ConflictError(`The execution "${executionId} has finished already.`); throw new ConflictError(`The execution "${executionId} has finished already.`);
} }
}
if (execution.data.resultData.error) { if (execution.data.resultData.error) {
throw new ConflictError(`The execution "${executionId} has finished already.`); throw new ConflictError(`The execution "${executionId} has finished already.`);

View file

@ -267,7 +267,7 @@ export class Wait extends Webhook {
], ],
properties: [ properties: [
{ {
displayName: 'Resume', displayName: 'Resume On',
name: 'resume', name: 'resume',
type: 'options', type: 'options',
options: [ options: [