fix adding meshes and user groups in a peering environment (#6534)

This commit is contained in:
ijustw0rkhere 2024-11-15 16:54:28 -05:00 committed by GitHub
parent 727080ab68
commit 3da60b43ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

26
db.js
View File

@ -4089,12 +4089,13 @@ module.exports.CreateDB = function (parent, func) {
}
// Send the mesh update
if (mesh.deleted) { mesh.action = 'deletemesh'; } else { mesh.action = (added ? 'createmesh' : 'meshchange'); }
mesh.meshid = mesh._id;
mesh.nolog = 1;
delete mesh.type;
delete mesh._id;
parent.DispatchEvent(['*', mesh.meshid], obj, parent.webserver.CloneSafeMesh(mesh));
var mesh2 = Object.assign({}, mesh); // Shallow clone
if (mesh2.deleted) { mesh2.action = 'deletemesh'; } else { mesh2.action = (added ? 'createmesh' : 'meshchange'); }
mesh2.meshid = mesh2._id;
mesh2.nolog = 1;
delete mesh2.type;
delete mesh2._id;
parent.DispatchEvent(['*', mesh2.meshid], obj, parent.webserver.CloneSafeMesh(mesh2));
}
// Called when a user account has changed
@ -4138,12 +4139,13 @@ module.exports.CreateDB = function (parent, func) {
}
// Send the user group update
usergroup.action = (added ? 'createusergroup' : 'usergroupchange');
usergroup.ugrpid = usergroup._id;
usergroup.nolog = 1;
delete usergroup.type;
delete usergroup._id;
parent.DispatchEvent(['*', usergroup.ugrpid], obj, usergroup);
var usergroup2 = Object.assign({}, usergroup); // Shallow clone
usergroup2.action = (added ? 'createusergroup' : 'usergroupchange');
usergroup2.ugrpid = usergroup2._id;
usergroup2.nolog = 1;
delete usergroup2.type;
delete usergroup2._id;
parent.DispatchEvent(['*', usergroup2.ugrpid], obj, usergroup2);
}
function dbMergeSqlArray(arr) {