diff --git a/server/notification.js b/server/notification.js index da4e9f3d2..465038f0d 100644 --- a/server/notification.js +++ b/server/notification.js @@ -329,7 +329,10 @@ class Notification { }); this.cacheLastRefresh = Date.now(); - log.debug("notification", `Refreshed notification cache with ${this.notificationCache.length} notifications (database down opt-in)`); + log.debug( + "notification", + `Refreshed notification cache with ${this.notificationCache.length} notifications (database down opt-in)` + ); } catch (e) { log.error("notification", `Failed to refresh notification cache: ${e.message}`); // Don't clear the cache if refresh fails, keep using old cache diff --git a/src/components/NotificationDialog.vue b/src/components/NotificationDialog.vue index 8f62f3cea..4be3b400d 100644 --- a/src/components/NotificationDialog.vue +++ b/src/components/NotificationDialog.vue @@ -129,10 +129,14 @@ -
+
- +
@@ -422,7 +426,8 @@ export default { this.notification = JSON.parse(n.config); // Load send_database_down from database (not stored in config) if (n.send_database_down !== undefined) { - this.notification.sendDatabaseDown = n.send_database_down === 1 || n.send_database_down === true; + this.notification.sendDatabaseDown = + n.send_database_down === 1 || n.send_database_down === true; } else { this.notification.sendDatabaseDown = false; } diff --git a/test/backend-test/test-database-down-notification.js b/test/backend-test/test-database-down-notification.js index 98da528c9..a9ae2f1b9 100644 --- a/test/backend-test/test-database-down-notification.js +++ b/test/backend-test/test-database-down-notification.js @@ -83,8 +83,7 @@ describe("Database Down Notification", () => { const nonOptInBean = R.dispense("notification"); nonOptInBean.name = "Non-Opt-In Notification"; nonOptInBean.user_id = 1; - nonOptInBean.config = JSON.stringify({ type: "webhook", - webhookURL: "https://example.com/webhook2" }); + nonOptInBean.config = JSON.stringify({ type: "webhook", webhookURL: "https://example.com/webhook2" }); nonOptInBean.active = 1; nonOptInBean.is_default = 0; nonOptInBean.send_database_down = 0; // NOT opted-in @@ -97,7 +96,7 @@ describe("Database Down Notification", () => { assert.ok(Notification.cacheLastRefresh > 0, "Cache refresh time should be set"); // Verify test notification (opt-in) is in cache - const cached = Notification.notificationCache.find(n => n.id === testNotification.id); + const cached = Notification.notificationCache.find((n) => n.id === testNotification.id); assert.ok(cached, "Opt-in notification should be in cache"); assert.strictEqual(cached.name, "Test Notification"); // Config is stored as raw string, parse to verify @@ -105,7 +104,7 @@ describe("Database Down Notification", () => { assert.strictEqual(config.type, "webhook"); // Verify non-opt-in notification is NOT in cache - const nonOptInCached = Notification.notificationCache.find(n => n.id === nonOptInBean.id); + const nonOptInCached = Notification.notificationCache.find((n) => n.id === nonOptInBean.id); assert.strictEqual(nonOptInCached, undefined, "Non-opt-in notification should NOT be in cache"); } finally { // Clean up