Commit 6b195da3 authored by Matthieu Fesselier's avatar Matthieu Fesselier

syntax: improve onRead function

parent abd23ee9
Pipeline #3189 passed with stage
in 27 seconds
......@@ -48,12 +48,10 @@ class SIBNotifications extends SIBTemplateElement {
/* Events listeners */
_onReadResource(resourceId) {
let edits = []
this._getNotificationsList().forEach(notification => {
if (notification.unread && notification.object['@id'] === resourceId) {
edits.push(store.patch(notification['@id'], { unread: false }))
}
})
const edits = this._getNotificationsList()
.filter((notification) => notification.unread && notification.object['@id'] === resourceId)
.map((notification) => store.patch(notification['@id'], { unread: false }))
Promise.all(edits)
.then(() => this.render())
.catch((error) => this._printError(error));
......
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