Skip to content

EspoCRM – Open Source CRM Application

Mark read group notifications

Yuriidddf2e05223b
diff --git a/client/src/views/notification/fields/container.js b/client/src/views/notification/fields/container.js
index abb668ef05..f3eac60c63 100644
--- a/client/src/views/notification/fields/container.js
+++ b/client/src/views/notification/fields/container.js
@@ -301,6 +301,14 @@ class NotificationContainerFieldView extends BaseFieldView {
await this.reRender();
this.triggerUpdateRead();
+
+ if (this.model.collection) {
+ view.listenTo(this.model.collection, 'all-read', () => {
+ collection.models.forEach(model => {
+ model.set('read', true, {sync: true});
+ });
+ });
+ }
}
/**
diff --git a/client/src/views/notification/list.js b/client/src/views/notification/list.js
index 0bc2ee012c..5efcd2d1a4 100644
--- a/client/src/views/notification/list.js
+++ b/client/src/views/notification/list.js
@@ -132,6 +132,10 @@ class NotificationListView extends View {
this.$el.find('.badge-circle-warning').remove();
})
.finally(() => $link.removeAttr('disabled').removeClass('disabled'));
+
+ this.collection.models.forEach(model => {
+ model.set('read', true, {sync: true});
+ });
}
/**
diff --git a/client/src/views/notification/panel.js b/client/src/views/notification/panel.js
index a330784eb7..e4db6eff6c 100644
--- a/client/src/views/notification/panel.js
+++ b/client/src/views/notification/panel.js
@@ -118,6 +118,10 @@ class NotificationPanelView extends View {
await Espo.Ajax.postRequest('Notification/action/markAllRead');
this.trigger('all-read')
+
+ this.collection.models.forEach(model => {
+ model.set('read', true, {sync: true});
+ });
}
close() {