mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-01-25 21:53:14 -05:00
Fixed empty notifications titles, #4155
This commit is contained in:
parent
1e368f52b3
commit
af0ff09144
@ -2913,7 +2913,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||||||
// Perform input validation
|
// Perform input validation
|
||||||
try {
|
try {
|
||||||
if (common.validateStrArray(command.nodeids, 1, 256) == false) { err = "Invalid nodeids"; } // Check nodeids
|
if (common.validateStrArray(command.nodeids, 1, 256) == false) { err = "Invalid nodeids"; } // Check nodeids
|
||||||
else if (common.validateString(command.title, 1, 512) == false) { err = "Invalid title"; } // Check title
|
|
||||||
else if (common.validateString(command.msg, 1, 4096) == false) { err = "Invalid message"; } // Check message
|
else if (common.validateString(command.msg, 1, 4096) == false) { err = "Invalid message"; } // Check message
|
||||||
else {
|
else {
|
||||||
var nodeids = [];
|
var nodeids = [];
|
||||||
@ -2928,6 +2927,12 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check the title, if needed, use a default one
|
||||||
|
if (common.validateString(command.title, 1, 512) == false) { delete command.title } // Check title
|
||||||
|
if ((command.title == null) && (typeof domain.notificationmessages == 'object') && (typeof domain.notificationmessages.title == 'string')) { command.title = domain.notificationmessages.title; }
|
||||||
|
if ((command.title == null) && (typeof domain.title == 'string')) { command.title = domain.title; }
|
||||||
|
if (command.title == null) { command.title = "MeshCentral"; }
|
||||||
|
|
||||||
for (i in command.nodeids) {
|
for (i in command.nodeids) {
|
||||||
// Get the node and the rights for this node
|
// Get the node and the rights for this node
|
||||||
parent.GetNodeWithRights(domain, user, command.nodeids[i], function (node, rights, visible) {
|
parent.GetNodeWithRights(domain, user, command.nodeids[i], function (node, rights, visible) {
|
||||||
|
@ -5551,6 +5551,7 @@
|
|||||||
var op = Q('d2deviceop').value, title = Q('dp2notifyTitle').value, msg = Q('d2notifyMsg').value, chkNodeIds = getCheckedDevices();
|
var op = Q('d2deviceop').value, title = Q('dp2notifyTitle').value, msg = Q('d2notifyMsg').value, chkNodeIds = getCheckedDevices();
|
||||||
if (msg.length == 0) return;
|
if (msg.length == 0) return;
|
||||||
if (title == '') { title = decodeURIComponent('{{{extitle}}}'); }
|
if (title == '') { title = decodeURIComponent('{{{extitle}}}'); }
|
||||||
|
if (title == '') { title = "MeshCentral"; }
|
||||||
if (op == 1) { // MessageBox
|
if (op == 1) { // MessageBox
|
||||||
for (var i = 0; i < chkNodeIds.length; i++) { meshserver.send({ action: 'msg', type: 'messagebox', nodeid: chkNodeIds[i], title: title, msg: msg }); }
|
for (var i = 0; i < chkNodeIds.length; i++) { meshserver.send({ action: 'msg', type: 'messagebox', nodeid: chkNodeIds[i], title: title, msg: msg }); }
|
||||||
} else if (op == 2) { // Toast
|
} else if (op == 2) { // Toast
|
||||||
@ -7599,10 +7600,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function deviceMessageFunctionEx() {
|
function deviceMessageFunctionEx() {
|
||||||
|
var title = decodeURIComponent('{{{extitle}}}');
|
||||||
|
if (title == '') { title = "MeshCentral"; }
|
||||||
if (currentNode.pmt == 1) {
|
if (currentNode.pmt == 1) {
|
||||||
meshserver.send({ action: 'pushmessage', nodeid: currentNode._id, title: decodeURIComponent('{{{extitle}}}'), msg: Q('d2devMessage').value });
|
meshserver.send({ action: 'pushmessage', nodeid: currentNode._id, title: title, msg: Q('d2devMessage').value });
|
||||||
} else {
|
} else {
|
||||||
meshserver.send({ action: 'msg', type: 'messagebox', nodeid: currentNode._id, title: decodeURIComponent('{{{extitle}}}'), msg: Q('d2devMessage').value });
|
meshserver.send({ action: 'msg', type: 'messagebox', nodeid: currentNode._id, title: title, msg: Q('d2devMessage').value });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user