mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
fix: Chat triggers don't work with the new partial execution flow (#11952)
This commit is contained in:
@@ -23,6 +23,7 @@ import type { TestWebhookRegistration } from '@/webhooks/test-webhook-registrati
|
||||
import { TestWebhookRegistrationsService } from '@/webhooks/test-webhook-registrations.service';
|
||||
import * as WebhookHelpers from '@/webhooks/webhook-helpers';
|
||||
import * as WorkflowExecuteAdditionalData from '@/workflow-execute-additional-data';
|
||||
import type { WorkflowRequest } from '@/workflows/workflow.request';
|
||||
|
||||
import type {
|
||||
IWebhookResponseCallbackData,
|
||||
@@ -218,25 +219,48 @@ export class TestWebhooks implements IWebhookManager {
|
||||
* Return whether activating a workflow requires listening for webhook calls.
|
||||
* For every webhook call to listen for, also activate the webhook.
|
||||
*/
|
||||
async needsWebhook(
|
||||
userId: string,
|
||||
workflowEntity: IWorkflowDb,
|
||||
additionalData: IWorkflowExecuteAdditionalData,
|
||||
runData?: IRunData,
|
||||
pushRef?: string,
|
||||
destinationNode?: string,
|
||||
) {
|
||||
async needsWebhook(options: {
|
||||
userId: string;
|
||||
workflowEntity: IWorkflowDb;
|
||||
additionalData: IWorkflowExecuteAdditionalData;
|
||||
runData?: IRunData;
|
||||
pushRef?: string;
|
||||
destinationNode?: string;
|
||||
triggerToStartFrom?: WorkflowRequest.ManualRunPayload['triggerToStartFrom'];
|
||||
}) {
|
||||
const {
|
||||
userId,
|
||||
workflowEntity,
|
||||
additionalData,
|
||||
runData,
|
||||
pushRef,
|
||||
destinationNode,
|
||||
triggerToStartFrom,
|
||||
} = options;
|
||||
|
||||
if (!workflowEntity.id) throw new WorkflowMissingIdError(workflowEntity);
|
||||
|
||||
const workflow = this.toWorkflow(workflowEntity);
|
||||
|
||||
const webhooks = WebhookHelpers.getWorkflowWebhooks(
|
||||
let webhooks = WebhookHelpers.getWorkflowWebhooks(
|
||||
workflow,
|
||||
additionalData,
|
||||
destinationNode,
|
||||
true,
|
||||
);
|
||||
|
||||
// If we have a preferred trigger with data, we don't have to listen for a
|
||||
// webhook.
|
||||
if (triggerToStartFrom?.data) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If we have a preferred trigger without data we only want to listen for
|
||||
// that trigger, not the other ones.
|
||||
if (triggerToStartFrom) {
|
||||
webhooks = webhooks.filter((w) => w.node === triggerToStartFrom.name);
|
||||
}
|
||||
|
||||
if (!webhooks.some((w) => w.webhookDescription.restartWebhook !== true)) {
|
||||
return false; // no webhooks found to start a workflow
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user