0
0
mirror of https://github.com/louislam/uptime-kuma.git synced 2024-11-21 10:48:58 +01:00

fix(status page): Make sure the group deletion is correctly handled when groupIDList is empty (#5340)

This commit is contained in:
Ionys 2024-11-12 19:00:09 +01:00 committed by GitHub
parent 778363a948
commit 8a432ac937
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -220,13 +220,17 @@ module.exports.statusPageSocketHandler = (socket) => {
// Delete groups that are not in the list // Delete groups that are not in the list
log.debug("socket", "Delete groups that are not in the list"); log.debug("socket", "Delete groups that are not in the list");
const slots = groupIDList.map(() => "?").join(","); if (groupIDList.length === 0) {
await R.exec("DELETE FROM `group` WHERE status_page_id = ?", [ statusPage.id ]);
} else {
const slots = groupIDList.map(() => "?").join(",");
const data = [ const data = [
...groupIDList, ...groupIDList,
statusPage.id statusPage.id
]; ];
await R.exec(`DELETE FROM \`group\` WHERE id NOT IN (${slots}) AND status_page_id = ?`, data); await R.exec(`DELETE FROM \`group\` WHERE id NOT IN (${slots}) AND status_page_id = ?`, data);
}
const server = UptimeKumaServer.getInstance(); const server = UptimeKumaServer.getInstance();