Merge pull request #4892 from GogoVega/fix-4891

Fix `link call` node can call out of a subflow
This commit is contained in:
Nick O'Leary 2024-10-08 16:39:19 +01:00 committed by GitHub
commit b1bfba8b01
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2408,7 +2408,7 @@ RED.nodes = (function() {
}
// If importing a link node, ensure both ends of each link are either:
// - not in a subflow
// - both in the same subflow
// - both in the same subflow (not for link call node)
if (/^link /.test(n.type) && n.links) {
n.links = n.links.filter(function(id) {
const otherNode = node_map[id] || RED.nodes.node(id);
@ -2419,9 +2419,13 @@ RED.nodes = (function() {
if (otherNode.z === n.z) {
// Both ends in the same flow/subflow
return true
} else if (n.type === "link call" && !!getSubflow(otherNode.z)) {
// Link call node can call out of a subflow as long as otherNode is
// not in a subflow
return false
} else if (!!getSubflow(n.z) || !!getSubflow(otherNode.z)) {
// One end is in a subflow - remove the link
return false
return false
}
return true
});