mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-13 05:47:31 -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 = (str: string) =>
|
||||
TRIGGER_NODE_SUFFIXES.some((suffix) => str.toLowerCase().includes(suffix));
|
||||
const isTrigger = (nodeType: string) =>
|
||||
['trigger', 'webhook'].some((suffix) => nodeType.toLowerCase().includes(suffix));
|
||||
|
||||
function findFirstPinnedTrigger(workflow: IWorkflowDb, pinData?: IPinData) {
|
||||
if (!pinData) return;
|
||||
|
||||
const firstPinnedTriggerName = Object.keys(pinData).find(isTrigger);
|
||||
|
||||
if (!firstPinnedTriggerName) return;
|
||||
|
||||
return workflow.nodes.find(
|
||||
({ type, name }) => isTrigger(type) && name === firstPinnedTriggerName,
|
||||
);
|
||||
return workflow.nodes.find((node) => isTrigger(node.type) && pinData[node.name]);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue