return correct responses for removedevices #7273

Signed-off-by: si458 <simonsmith5521@gmail.com>

si458 committed Sep 16, 2025 at 14:53 UTC ce5111477d1353d7b120dd78b98c2020edf037b9
1 file changed +7 -4
meshuser.js
+7 -4
@@ -2812,7 +2812,10 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
2812 // Get the node and the rights for this node
2813 parent.GetNodeWithRights(domain, user, nodeid, function (node, rights, visible) {
2814 // Check we have the rights to delete this device
2815 - if ((rights & MESHRIGHT_UNINSTALL) == 0) return;
2815 + if ((rights & MESHRIGHT_UNINSTALL) == 0) {
2816 + if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'removedevices', responseid: command.responseid, result: 'Denied' })); } catch (ex) { } }
2817 + return;
2818 + }
2819
2820 // Delete this node including network interface information, events and timeline
2821 db.Remove(node._id); // Remove node with that id
@@ -2877,12 +2880,12 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
2880 if ((state.connectivity & 1) != 0) { parent.wsagents[nodeid].close(); } // Disconnect mesh agent
2881 if ((state.connectivity & 2) != 0) { parent.parent.mpsserver.closeAllForNode(nodeid); } // Disconnect CIRA/Relay/LMS connections
2882 }
2883 +
2884 + // Send response if required
2885 + if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'removedevices', responseid: command.responseid, result: 'ok' })); } catch (ex) { } }
2886 });
2887 }
2888
2883 - // Send response if required, in this case we always send ok which is not ideal.
2884 - if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'removedevices', responseid: command.responseid, result: 'ok' })); } catch (ex) { } }
2885 -
2889 break;
2890 }
2891 case 'wakedevices':