mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Fix Group import and user deletion (bad object reference)
This commit is contained in:
parent
e6fa0514ed
commit
5d78c546bc
@ -680,7 +680,7 @@ RED.nodes = (function() {
|
|||||||
if (n.wires && (n.wires.length > n.outputs)) { n.outputs = n.wires.length; }
|
if (n.wires && (n.wires.length > n.outputs)) { n.outputs = n.wires.length; }
|
||||||
n.dirty = true;
|
n.dirty = true;
|
||||||
// TODO: The event should be triggered?
|
// TODO: The event should be triggered?
|
||||||
updateConfigNodeUsers(n, { action: "add", emitEvent: false });
|
updateConfigNodeUsers(newNode, { action: "add" });
|
||||||
// TODO: What is this property used for?
|
// TODO: What is this property used for?
|
||||||
if (n._def.category == "subflows" && typeof n.i === "undefined") {
|
if (n._def.category == "subflows" && typeof n.i === "undefined") {
|
||||||
var nextId = 0;
|
var nextId = 0;
|
||||||
@ -754,6 +754,9 @@ RED.nodes = (function() {
|
|||||||
delete nodeLinks[id];
|
delete nodeLinks[id];
|
||||||
removedLinks = links.filter(function(l) { return (l.source === node) || (l.target === node); });
|
removedLinks = links.filter(function(l) { return (l.source === node) || (l.target === node); });
|
||||||
removedLinks.forEach(removeLink);
|
removedLinks.forEach(removeLink);
|
||||||
|
// TODO: The event should not be triggered?
|
||||||
|
updateConfigNodeUsers(node, { action: "remove" });
|
||||||
|
|
||||||
var updatedConfigNode = false;
|
var updatedConfigNode = false;
|
||||||
for (var d in node._def.defaults) {
|
for (var d in node._def.defaults) {
|
||||||
if (node._def.defaults.hasOwnProperty(d)) {
|
if (node._def.defaults.hasOwnProperty(d)) {
|
||||||
@ -764,13 +767,10 @@ RED.nodes = (function() {
|
|||||||
var configNode = configNodes[node[d]];
|
var configNode = configNodes[node[d]];
|
||||||
if (configNode) {
|
if (configNode) {
|
||||||
updatedConfigNode = true;
|
updatedConfigNode = true;
|
||||||
|
// TODO: Not sure if still exists
|
||||||
if (configNode._def.exclusive) {
|
if (configNode._def.exclusive) {
|
||||||
removeNode(node[d]);
|
removeNode(node[d]);
|
||||||
removedNodes.push(configNode);
|
removedNodes.push(configNode);
|
||||||
} else {
|
|
||||||
var users = configNode.users;
|
|
||||||
users.splice(users.indexOf(node),1);
|
|
||||||
RED.events.emit('nodes:change',configNode)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2337,7 +2337,8 @@ RED.nodes = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const isConfigNode = def?.category === "config";
|
// TODO: Group Node has config as category - why?
|
||||||
|
const isConfigNode = def?.category === "config" && node.type !== "group";
|
||||||
|
|
||||||
// Now the properties have been fixed, copy the node properties:
|
// Now the properties have been fixed, copy the node properties:
|
||||||
// NOTE: If the Node def is unknown, user properties will not be copied
|
// NOTE: If the Node def is unknown, user properties will not be copied
|
||||||
|
Loading…
x
Reference in New Issue
Block a user