mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix(core): Fix pinned trigger execution (#3895)
🐛 Fix pinned trigger execution
This commit is contained in:
parent
329fe9581f
commit
17799cda46
|
@ -2874,19 +2874,11 @@ function isOAuth(credType: ICredentialType) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const TRIGGER_NODE_SUFFIXES = ['trigger', 'webhook'];
|
const isTrigger = (nodeType: string) =>
|
||||||
|
['trigger', 'webhook'].some((suffix) => nodeType.toLowerCase().includes(suffix));
|
||||||
const isTrigger = (str: string) =>
|
|
||||||
TRIGGER_NODE_SUFFIXES.some((suffix) => str.toLowerCase().includes(suffix));
|
|
||||||
|
|
||||||
function findFirstPinnedTrigger(workflow: IWorkflowDb, pinData?: IPinData) {
|
function findFirstPinnedTrigger(workflow: IWorkflowDb, pinData?: IPinData) {
|
||||||
if (!pinData) return;
|
if (!pinData) return;
|
||||||
|
|
||||||
const firstPinnedTriggerName = Object.keys(pinData).find(isTrigger);
|
return workflow.nodes.find((node) => isTrigger(node.type) && pinData[node.name]);
|
||||||
|
|
||||||
if (!firstPinnedTriggerName) return;
|
|
||||||
|
|
||||||
return workflow.nodes.find(
|
|
||||||
({ type, name }) => isTrigger(type) && name === firstPinnedTriggerName,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue