Skip to content

EspoCRM – Open Source CRM Application

Email mark all as read improvement

Yurii21f259867202
diff --git a/client/src/views/email-folder/list-side.js b/client/src/views/email-folder/list-side.js
index edf0131831..ecb9be56bc 100644
--- a/client/src/views/email-folder/list-side.js
+++ b/client/src/views/email-folder/list-side.js
@@ -82,6 +82,7 @@ export default class extends View {
}
this.renderCounts();
+ this.loadNotReadCounts();
});
this.listenTo(this.emailCollection, 'draft-sent', () => {
diff --git a/client/src/views/email/record/list.js b/client/src/views/email/record/list.js
index 6d11626aed..0efc36583f 100644
--- a/client/src/views/email/record/list.js
+++ b/client/src/views/email/record/list.js
@@ -30,6 +30,7 @@
import ListRecordView from 'views/record/list';
import MassActionHelper from 'helpers/mass-action';
+import Ui from 'ui';
class EmailListRecordView extends ListRecordView {
@@ -400,14 +401,18 @@ class EmailListRecordView extends ListRecordView {
}
}
- actionMarkAllAsRead() {
- Espo.Ajax.postRequest('Email/inbox/read', {all: true});
+ async actionMarkAllAsRead() {
+ this.collection.trigger('all-marked-read');
- this.collection.forEach(model => {
- model.set('isRead', true);
- });
+ const ids = this.collection.models.map(m => m.id);
- this.collection.trigger('all-marked-read');
+ await Espo.Ajax.postRequest('Email/inbox/read', {all: true});
+
+ const models = this.collection.models.filter(m => ids.includes(m.id));
+
+ models.forEach(model => {
+ model.set('isRead', true, {sync: true});
+ });
}
// noinspection JSUnusedGlobalSymbols