mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Added support for help request emails (#4489)
This commit is contained in:
parent
9738848dc5
commit
4e86b319f7
47 changed files with 2911 additions and 2155 deletions
10
meshagent.js
10
meshagent.js
|
@ -1363,6 +1363,16 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
|||
}
|
||||
if ((typeof command.sessionid == 'string') && (command.sessionid.length < 500)) { event.sessionid = command.sessionid; }
|
||||
parent.parent.DispatchEvent(targets, obj, event);
|
||||
|
||||
// If this is a help request, see if we need to email notify anyone
|
||||
if (event.msgid == 98) {
|
||||
// Get the node and change it if needed
|
||||
db.Get(obj.dbNodeKey, function (err, nodes) { // TODO: THIS IS A BIG RACE CONDITION HERE, WE NEED TO FIX THAT. If this call is made twice at the same time on the same device, data will be missed.
|
||||
if ((nodes == null) || (nodes.length != 1)) { delete obj.deviceChanging; return; }
|
||||
const device = nodes[0];
|
||||
if (typeof device.name == 'string') { parent.parent.NotifyUserOfDeviceHelpRequest(domain, device.meshid, device._id, device.name, command.msgArgs[0], command.msgArgs[1]); }
|
||||
});
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue