Commit c595706e authored by Matthieu Fesselier's avatar Matthieu Fesselier

bugfix: update badge when new notification

parent 9aa6ccee
Pipeline #7121 passed with stage
in 1 minute and 31 seconds
......@@ -7,7 +7,7 @@ Helpers.importCSS(`${base_url}/css/badge.css`);
class SIBBadge extends SIBTemplateElement {
constructor() {
super()
super();
// On read events, remove badge
window.addEventListener('read', event => {
......@@ -18,7 +18,9 @@ class SIBBadge extends SIBTemplateElement {
event.detail.resource['@id'] == this.resourceId) {
this.querySelector('.counter').remove();
}
})
});
window.addEventListener('notificationsRefresh', this.render.bind(this));
}
get resourceId() {
......@@ -38,7 +40,7 @@ class SIBBadge extends SIBTemplateElement {
<sib-display
bind-user
nested-field="inbox"
fields="none"
fields
search-fields="unread, object"
search-value-unread="true"
search-value-object="${this.resourceId}"
......
......@@ -89,6 +89,8 @@ class SIBNotifications extends SIBTemplateElement {
const notifications = this._getNotificationsList();
if (notifications) notifications.clearCache(); // clear container cache
this.render();
window.dispatchEvent(new CustomEvent('notificationsRefresh', { bubbles: true }));
}
/* Events listeners */
......
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