From 64fa48981eb5009938c53f0692940173580d5875 Mon Sep 17 00:00:00 2001 From: Vito0912 <86927734+Vito0912@users.noreply.github.com> Date: Sat, 17 May 2025 18:20:15 +0200 Subject: [PATCH] fixed Unit-Test and added void for to async methods --- server/managers/NotificationManager.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/server/managers/NotificationManager.js b/server/managers/NotificationManager.js index deb80e71..bec73a9a 100644 --- a/server/managers/NotificationManager.js +++ b/server/managers/NotificationManager.js @@ -43,7 +43,7 @@ class NotificationManager { episodeSubtitle: episode.subtitle || '', episodeDescription: episode.description || '' } - this.triggerNotification('onPodcastEpisodeDownloaded', eventData) + void this.triggerNotification('onPodcastEpisodeDownloaded', eventData) } /** @@ -68,7 +68,7 @@ class NotificationManager { backupCount: totalBackupCount || 'Invalid', removedOldest: removedOldest || 'false' } - this.triggerNotification('onBackupCompleted', eventData) + void this.triggerNotification('onBackupCompleted', eventData) } /** @@ -87,11 +87,11 @@ class NotificationManager { const eventData = { errorMsg: errorMsg || 'Backup failed' } - this.triggerNotification('onBackupFailed', eventData) + void this.triggerNotification('onBackupFailed', eventData) } onTest() { - this.triggerNotification('onTest') + void this.triggerNotification('onTest') } /** @@ -157,7 +157,7 @@ class NotificationManager { if (this.notificationQueue.length) { // Send next notification in queue const nextNotificationEvent = this.notificationQueue.shift() - this.triggerNotification(nextNotificationEvent.eventName, nextNotificationEvent.eventData) + void this.triggerNotification(nextNotificationEvent.eventName, nextNotificationEvent.eventData) } }, Database.notificationSettings.notificationDelay) } @@ -187,14 +187,14 @@ class NotificationManager { } fireNotificationFromSocket(eventName, eventData) { - if (!Database.notificationSettings.isUseable) return + if (!Database.notificationSettings || !Database.notificationSettings.isUseable) return const eventNameModified = eventName.replace(/_([a-z])/g, (_, c) => c.toUpperCase()) const eventKey = `on${eventNameModified.charAt(0).toUpperCase()}${eventNameModified.slice(1)}` if (!Database.notificationSettings.getHasActiveNotificationsForEvent(eventKey)) { // No logging to prevent console spam - Logger.debug(`[NotificationManager] fireSocketNotification: No active notifications`) + //Logger.debug(`[NotificationManager] fireSocketNotification: No active notifications`) return }