diff --git a/server/notification.js b/server/notification.js index b2d9d5812..83dabc537 100644 --- a/server/notification.js +++ b/server/notification.js @@ -99,6 +99,8 @@ class Notification { if (notification.applyExisting) { await applyNotificationEveryMonitor(bean.id, userID); } + + return bean; } static async delete(notificationID, userID) { diff --git a/server/server.js b/server/server.js index bfebb89fc..2949c4be7 100644 --- a/server/server.js +++ b/server/server.js @@ -527,12 +527,13 @@ let indexHTML = fs.readFileSync("./dist/index.html").toString(); try { checkLogin(socket) - await Notification.save(notification, notificationID, socket.userID) + let notificationBean = await Notification.save(notification, notificationID, socket.userID) await sendNotificationList(socket) callback({ ok: true, msg: "Saved", + id: notificationBean.id, }); } catch (e) { diff --git a/src/components/NotificationDialog.vue b/src/components/NotificationDialog.vue index 447b19266..6d54d5652 100644 --- a/src/components/NotificationDialog.vue +++ b/src/components/NotificationDialog.vue @@ -454,6 +454,7 @@ export default { SMTP, }, props: {}, + emits: ["added"], data() { return { model: null, @@ -532,7 +533,13 @@ export default { this.processing = false; if (res.ok) { - this.modal.hide() + this.modal.hide(); + + // Emit added event, doesn't emit edit. + if (! this.id) { + this.$emit("added", res.id); + } + } }) }, diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index ed09a7bad..420c4900e 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -10,7 +10,7 @@