mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-31 13:51:30 +02:00
fixed Unit-Test and added void for to async methods
This commit is contained in:
parent
dc41ccc377
commit
64fa48981e
@ -43,7 +43,7 @@ class NotificationManager {
|
|||||||
episodeSubtitle: episode.subtitle || '',
|
episodeSubtitle: episode.subtitle || '',
|
||||||
episodeDescription: episode.description || ''
|
episodeDescription: episode.description || ''
|
||||||
}
|
}
|
||||||
this.triggerNotification('onPodcastEpisodeDownloaded', eventData)
|
void this.triggerNotification('onPodcastEpisodeDownloaded', eventData)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -68,7 +68,7 @@ class NotificationManager {
|
|||||||
backupCount: totalBackupCount || 'Invalid',
|
backupCount: totalBackupCount || 'Invalid',
|
||||||
removedOldest: removedOldest || 'false'
|
removedOldest: removedOldest || 'false'
|
||||||
}
|
}
|
||||||
this.triggerNotification('onBackupCompleted', eventData)
|
void this.triggerNotification('onBackupCompleted', eventData)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -87,11 +87,11 @@ class NotificationManager {
|
|||||||
const eventData = {
|
const eventData = {
|
||||||
errorMsg: errorMsg || 'Backup failed'
|
errorMsg: errorMsg || 'Backup failed'
|
||||||
}
|
}
|
||||||
this.triggerNotification('onBackupFailed', eventData)
|
void this.triggerNotification('onBackupFailed', eventData)
|
||||||
}
|
}
|
||||||
|
|
||||||
onTest() {
|
onTest() {
|
||||||
this.triggerNotification('onTest')
|
void this.triggerNotification('onTest')
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -157,7 +157,7 @@ class NotificationManager {
|
|||||||
if (this.notificationQueue.length) {
|
if (this.notificationQueue.length) {
|
||||||
// Send next notification in queue
|
// Send next notification in queue
|
||||||
const nextNotificationEvent = this.notificationQueue.shift()
|
const nextNotificationEvent = this.notificationQueue.shift()
|
||||||
this.triggerNotification(nextNotificationEvent.eventName, nextNotificationEvent.eventData)
|
void this.triggerNotification(nextNotificationEvent.eventName, nextNotificationEvent.eventData)
|
||||||
}
|
}
|
||||||
}, Database.notificationSettings.notificationDelay)
|
}, Database.notificationSettings.notificationDelay)
|
||||||
}
|
}
|
||||||
@ -187,14 +187,14 @@ class NotificationManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fireNotificationFromSocket(eventName, eventData) {
|
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 eventNameModified = eventName.replace(/_([a-z])/g, (_, c) => c.toUpperCase())
|
||||||
const eventKey = `on${eventNameModified.charAt(0).toUpperCase()}${eventNameModified.slice(1)}`
|
const eventKey = `on${eventNameModified.charAt(0).toUpperCase()}${eventNameModified.slice(1)}`
|
||||||
|
|
||||||
if (!Database.notificationSettings.getHasActiveNotificationsForEvent(eventKey)) {
|
if (!Database.notificationSettings.getHasActiveNotificationsForEvent(eventKey)) {
|
||||||
// No logging to prevent console spam
|
// No logging to prevent console spam
|
||||||
Logger.debug(`[NotificationManager] fireSocketNotification: No active notifications`)
|
//Logger.debug(`[NotificationManager] fireSocketNotification: No active notifications`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user