From ad2130b7b5470fc56bd363cd0b206f09404f45ca Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Tue, 22 Mar 2022 00:06:29 +0800 Subject: [PATCH] [Status Page] Fix monitors are deleted unexpectedly #1399 --- server/socket-handlers/status-page-socket-handler.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/socket-handlers/status-page-socket-handler.js b/server/socket-handlers/status-page-socket-handler.js index cb04df8a..606e8481 100644 --- a/server/socket-handlers/status-page-socket-handler.js +++ b/server/socket-handlers/status-page-socket-handler.js @@ -178,7 +178,12 @@ module.exports.statusPageSocketHandler = (socket) => { // Delete groups that not in the list debug("Delete groups that not in the list"); const slots = groupIDList.map(() => "?").join(","); - await R.exec(`DELETE FROM \`group\` WHERE id NOT IN (${slots})`, groupIDList); + + const data = [ + ...groupIDList, + statusPage.id + ]; + await R.exec(`DELETE FROM \`group\` WHERE id NOT IN (${slots}) AND status_page_id = ?`, data); // Also change entry page to new slug if it is the default one, and slug is changed. if (server.entryPage === "statusPage-" + slug && statusPage.slug !== slug) {