Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -1126,18 +1126,22 @@ let needSetup = false;
log.info("DB", `Delete Monitor completed in: ${endTime - startTime} ms`);
}

callback({
ok: true,
msg: "successDeleted",
msgi18n: true,
});
if (callback) {
callback({
ok: true,
msg: "successDeleted",
msgi18n: true,
});
}
Comment on lines +1129 to +1135
Copy link

Copilot AI Nov 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While the callback validation prevents the crash, this pattern is inconsistent with all other socket handlers in this file (e.g., pauseMonitor, resumeMonitor, deleteTag, deleteNotification) which always call callbacks without checking. The root issue is that the backward compatibility logic (lines 1059-1062) allows callback to be undefined when only monitorID is provided. Consider whether callbacks should be required for this handler (consistent with other handlers) or if the backward compatibility should explicitly handle the no-callback case with a default no-op function, e.g., callback = callback || (() => {}); after the backward compatibility check.

Copilot uses AI. Check for mistakes.
await server.sendDeleteMonitorFromList(socket, monitorID);

} catch (e) {
callback({
ok: false,
msg: e.message,
});
if (callback) {
callback({
ok: false,
msg: e.message,
});
}
}
});

Expand Down
Loading