From ea37f56fef9687dce1d8cd78aa9f5fc0a716a827 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Sun, 29 Mar 2026 22:25:52 +0800 Subject: [PATCH] fix(notification): ensure applyExisting is not saved to database, and handle existing notifications --- server/notification.js | 6 +++++- src/components/NotificationDialog.vue | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/server/notification.js b/server/notification.js index 3e9085747..29a60a8fc 100644 --- a/server/notification.js +++ b/server/notification.js @@ -245,13 +245,17 @@ class Notification { bean = R.dispense("notification"); } + // applyExisting is one time only, don't save it to database. + const applyExisting = notification.applyExisting || false; + notification.applyExisting = false; + bean.name = notification.name; bean.user_id = userID; bean.config = JSON.stringify(notification); bean.is_default = notification.isDefault || false; await R.store(bean); - if (notification.applyExisting) { + if (applyExisting) { await applyNotificationEveryMonitor(bean.id, userID); } diff --git a/src/components/NotificationDialog.vue b/src/components/NotificationDialog.vue index 10aebd544..6250c4900 100644 --- a/src/components/NotificationDialog.vue +++ b/src/components/NotificationDialog.vue @@ -416,6 +416,10 @@ export default { for (let n of this.$root.notificationList) { if (n.id === notificationID) { this.notification = JSON.parse(n.config); + + // applyExisting is one time only, but it got saved to database previously. Workaround fix, set it to false here to deal with the problem. + this.notification.applyExisting = false; + break; } }