mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	Merge pull request #4857 from GogoVega/refix-4749
Fix subflow outbound-link filter
This commit is contained in:
		@@ -2406,11 +2406,24 @@ RED.nodes = (function() {
 | 
				
			|||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                delete n.g
 | 
					                delete n.g
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            // If importing into a subflow, ensure an outbound-link doesn't get added
 | 
					            // If importing a link node, ensure both ends of each link are either:
 | 
				
			||||||
            if (activeSubflow && /^link /.test(n.type) && n.links) {
 | 
					            // - not in a subflow
 | 
				
			||||||
 | 
					            // - both in the same subflow
 | 
				
			||||||
 | 
					            if (/^link /.test(n.type) && n.links) {
 | 
				
			||||||
                n.links = n.links.filter(function(id) {
 | 
					                n.links = n.links.filter(function(id) {
 | 
				
			||||||
                    const otherNode = node_map[id] || RED.nodes.node(id);
 | 
					                    const otherNode = node_map[id] || RED.nodes.node(id);
 | 
				
			||||||
                    return (otherNode && otherNode.z === activeWorkspace);
 | 
					                    if (!otherNode) {
 | 
				
			||||||
 | 
					                        // Cannot find other end - remove the link
 | 
				
			||||||
 | 
					                        return false
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    if (otherNode.z === n.z) {
 | 
				
			||||||
 | 
					                        // Both ends in the same flow/subflow
 | 
				
			||||||
 | 
					                        return true
 | 
				
			||||||
 | 
					                    } else if (!!getSubflow(n.z) || !!getSubflow(otherNode.z)) {
 | 
				
			||||||
 | 
					                        // One end is in a subflow - remove the link
 | 
				
			||||||
 | 
					                        return false                        
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    return true
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            for (var d3 in n._def.defaults) {
 | 
					            for (var d3 in n._def.defaults) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user