mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-11-29 11:52:45 +01:00
Notification create/update events UI
This commit is contained in:
1 parent
ff04eb8d5e
commit
b08ad8785e
9 files changed
+389
-9
No files matched your search
@@ -1,3 +1,5 @@
|
||||
const Notification = require('../Notification')
|
||||
|
||||
class NotificationSettings {
|
||||
constructor(settings = null) {
|
||||
this.id = 'notification-settings'
|
||||
@@ -41,5 +43,23 @@ class NotificationSettings {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
addNewEvent(payload) {
|
||||
if (!payload) return false
|
||||
// TODO: validate
|
||||
|
||||
const notification = new Notification()
|
||||
notification.setData(payload)
|
||||
this.notifications.push(notification)
|
||||
return true
|
||||
}
|
||||
|
||||
updateEvent(payload) {
|
||||
if (!payload) return false
|
||||
const notification = this.notifications.find(n => n.id === payload.id)
|
||||
if (!notification) return false
|
||||
|
||||
return notification.update(payload)
|
||||
}
|
||||
}
|
||||
module.exports = NotificationSettings
|
||||
Reference in new issue
Block a user