Commit 03db604b authored by Matthieu Fesselier's avatar Matthieu Fesselier

Merge branch 'bugfix/19-favicon-update-when-0' into 'master'

bugfix: favicon update when 0 unread notifications

Closes #19

See merge request !9
parents 879254de d2fc3c27
Pipeline #3679 passed with stage
in 27 seconds
......@@ -66,7 +66,8 @@ class SIBNotifications extends SIBTemplateElement {
/* Events listeners */
_onReadResource(resourceId) {
const edits = this._getNotificationsList()
.filter((notification) => notification.unread && notification.object['@id'] === resourceId)
.filter((notification) => notification.unread &&
(notification.object['@id'] === resourceId || notification['@id'] === resourceId))
.map((notification) => store.patch(notification['@id'], { unread: false }))
Promise.all(edits)
......@@ -83,13 +84,13 @@ class SIBNotifications extends SIBTemplateElement {
}
}
_onClickUnreadButton(target) {
this._onReadResource(target.closest('sib-display').resource.object['@id'])
this._onReadResource(target.closest('sib-display').resource['@id'])
target.disabled = true
}
_updateUnread() {
let unread = document.querySelector('#badge-unread').innerText
if (unread != 0) this.favicon.badge(unread)
let unread = Number(document.querySelector('#badge-unread').innerText)
this.favicon.badge(unread)
}
_getNotificationsList() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment