1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

Fixed empty notifications titles, #4155

This commit is contained in:
Ylian Saint-Hilaire 2022-06-23 11:43:47 -07:00
parent 1e368f52b3
commit af0ff09144
2 changed files with 11 additions and 3 deletions

View file

@ -2913,7 +2913,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
// Perform input validation
try {
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 {
var nodeids = [];
@ -2928,6 +2927,12 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
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) {
// Get the node and the rights for this node
parent.GetNodeWithRights(domain, user, command.nodeids[i], function (node, rights, visible) {