fix(notification): ensure applyExisting is not saved to database, and handle existing notifications

pull/7221/head
Louis Lam 2 months ago
parent 62bfc38c27
commit ea37f56fef

@ -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);
}

@ -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;
}
}

Loading…
Cancel
Save