Skip to content

EspoCRM – Open Source CRM Application

Notification not read indicator change

Yuriida229b733a78
diff --git a/client/res/templates/notification/fields/read-with-menu.tpl b/client/res/templates/notification/fields/read-with-menu.tpl
deleted file mode 100644
index 0be8c12fcb..0000000000
--- a/client/res/templates/notification/fields/read-with-menu.tpl
+++ /dev/null
@@ -1,19 +0,0 @@
- <div class="list-row-buttons pull-right">
- <div class="btn-group">
- <button type="button" class="btn btn-link btn-sm dropdown-toggle" data-toggle="dropdown">
- <span class="caret"></span>
- </button>
- <ul class="dropdown-menu pull-right">
- <li><a
- role="button"
- tabindex="0"
- class="action"
- data-action="quickRemove"
- data-id="{{model.id}}"
- >{{translate 'Remove'}}</a></li>
- </ul>
- </div>
- </div>
-{{#unless isRead}}
- <span class="badge-circle badge-circle-warning"></span>
-{{/unless}}
diff --git a/client/res/templates/notification/fields/read.tpl b/client/res/templates/notification/fields/read.tpl
deleted file mode 100644
index 5a97f6a50e..0000000000
--- a/client/res/templates/notification/fields/read.tpl
+++ /dev/null
@@ -1,3 +0,0 @@
-{{#unless isRead}}
- <span class="badge-circle badge-circle-warning"> </span>
-{{/unless}}
diff --git a/client/src/models/notification.js b/client/src/models/notification.js
index 68100c5117..04eb4a6387 100644
--- a/client/src/models/notification.js
+++ b/client/src/models/notification.js
@@ -43,4 +43,14 @@ export default class Notification extends Model {
this.urlRoot = 'Notification/group';
}
}
+
+ setMultiple(attributes, options) {
+ attributes = {...attributes};
+
+ if (attributes.read !== undefined) {
+ attributes.isNotRead = !attributes.read;
+ }
+
+ return super.setMultiple(attributes, options);
+ }
}
diff --git a/client/src/views/notification/fields/container.js b/client/src/views/notification/fields/container.js
index 3b0f47cdd7..bc01a6123f 100644
--- a/client/src/views/notification/fields/container.js
+++ b/client/src/views/notification/fields/container.js
@@ -258,12 +258,6 @@ class NotificationContainerFieldView extends BaseFieldView {
this.isGroupExpanded = true;
- /*if (this.model.attributes.read === false) {
- collection.models.forEach(model => {
- model.set('read', false);
- });
- }*/
-
const view = new NotificationListRecordView({
collection: collection,
showCount: false,
@@ -280,11 +274,6 @@ class NotificationContainerFieldView extends BaseFieldView {
},
],
],
- right: {
- name: 'read',
- view: 'views/notification/fields/read',
- width: 'var(--10px)',
- },
},
});
diff --git a/client/src/views/notification/fields/read-with-menu.js b/client/src/views/notification/fields/read-with-menu.js
deleted file mode 100644
index 818ce73699..0000000000
--- a/client/src/views/notification/fields/read-with-menu.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/************************************************************************
- * This file is part of EspoCRM.
- *
- * EspoCRM – Open Source CRM application.
- * Copyright (C) 2014-2026 EspoCRM, Inc.
- * Website: https://www.espocrm.com
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- *
- * The interactive user interfaces in modified source and object code versions
- * of this program must display Appropriate Legal Notices, as required under
- * Section 5 of the GNU Affero General Public License version 3.
- *
- * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
- * these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
- ************************************************************************/
-
-import BaseFieldView from 'views/fields/base';
-
-// noinspection JSUnusedGlobalSymbols
-export default class NotificationReadWithMenuFieldView extends BaseFieldView {
-
- type = 'read'
- listTemplate = 'notification/fields/read-with-menu'
- detailTemplate = 'notification/fields/read-with-menu'
-
- inlineEditDisabled = true
-
- getAttributeList() {
- return ['read'];
- }
-
- data() {
- return {
- isRead: this.model.get('read'),
- };
- }
-}
diff --git a/client/src/views/notification/fields/read.js b/client/src/views/notification/fields/read.js
deleted file mode 100644
index b652530624..0000000000
--- a/client/src/views/notification/fields/read.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/************************************************************************
- * This file is part of EspoCRM.
- *
- * EspoCRM – Open Source CRM application.
- * Copyright (C) 2014-2026 EspoCRM, Inc.
- * Website: https://www.espocrm.com
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- *
- * The interactive user interfaces in modified source and object code versions
- * of this program must display Appropriate Legal Notices, as required under
- * Section 5 of the GNU Affero General Public License version 3.
- *
- * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
- * these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
- ************************************************************************/
-
-import BaseFieldView from 'views/fields/base';
-
-class NotificationReadFieldView extends BaseFieldView {
-
- type = 'read'
- listTemplate = 'notification/fields/read'
- detailTemplate = 'notification/fields/read'
-
- inlineEditDisabled = true
-
- getAttributeList() {
- return ['read'];
- }
-
- data() {
- return {
- isRead: this.model.get('read'),
- };
- }
-}
-
-export default NotificationReadFieldView;
diff --git a/client/src/views/notification/list.js b/client/src/views/notification/list.js
index 9bc955902b..9051e3718f 100644
--- a/client/src/views/notification/list.js
+++ b/client/src/views/notification/list.js
@@ -82,6 +82,7 @@ class NotificationListView extends View {
selector: '.notification-list',
collection: this.collection,
showCount: false,
+ rowActionsView: 'views/record/row-actions/remove-only',
listLayout: {
rows: [
[
@@ -94,11 +95,6 @@ class NotificationListView extends View {
},
],
],
- right: {
- name: 'read',
- view: 'views/notification/fields/read-with-menu',
- width: 'var(--10px)',
- },
},
};
diff --git a/client/src/views/notification/panel.js b/client/src/views/notification/panel.js
index 21f946f135..c30841f0c8 100644
--- a/client/src/views/notification/panel.js
+++ b/client/src/views/notification/panel.js
@@ -108,11 +108,6 @@ class NotificationPanelView extends View {
}
]
],
- right: {
- name: 'read',
- view: 'views/notification/fields/read',
- width: 'var(--10px)',
- },
},
});
}
diff --git a/client/src/views/notification/record/list.js b/client/src/views/notification/record/list.js
index cc3d8fc096..5b05cd6d0b 100644
--- a/client/src/views/notification/record/list.js
+++ b/client/src/views/notification/record/list.js
@@ -32,12 +32,23 @@ import ListExpandedRecordView from 'views/record/list-expanded';
class NotificationListRecordView extends ListExpandedRecordView {
+ /**
+ * @protected
+ * @type {boolean}
+ */
+ hasStars = true
+
+ /**
+ * @protected
+ * @type {string}
+ */
+ starredAttribute = 'isNotRead'
+
/**
* @name collection
* @type module:collections/note
* @memberOf NotificationListRecordView#
*/
-
setup() {
super.setup();
diff --git a/client/src/views/record/list.js b/client/src/views/record/list.js
index 0948404a61..c1b500f563 100644
--- a/client/src/views/record/list.js
+++ b/client/src/views/record/list.js
@@ -619,6 +619,18 @@ class ListRecordView extends View {
*/
noAllResultMassActions
+ /**
+ * @protected
+ * @type {string}
+ */
+ starredAttribute = 'isStarred'
+
+ /**
+ * @protected
+ * @type {boolean}
+ */
+ hasStars
+
/** @inheritDoc */
events = {
/**
@@ -1013,7 +1025,7 @@ class ListRecordView extends View {
return {
id: id,
isStarred: this.hasStars && this.collection.get(id) ?
- this.collection.get(id).attributes.isStarred :
+ this.collection.get(id).attributes[this.starredAttribute] :
false,
};
}) : [];
@@ -2091,11 +2103,7 @@ class ListRecordView extends View {
this.forceSettings = true;
}
- /**
- * @private
- * @type {boolean}
- */
- this.hasStars = this.getMetadata().get(`scopes.${this.entityType}.stars`) || false;
+ this.hasStars = this.hasStars ?? this.getMetadata().get(`scopes.${this.entityType}.stars`) ?? false;
if (
this.getUser().isPortal() &&
@@ -2189,6 +2197,22 @@ class ListRecordView extends View {
if (this.columnResize && this._listSettingsHelper) {
this._columnResizeHelper = new ListColumnResizeHelper(this, this._listSettingsHelper);
}
+
+ if (this.hasStars) {
+ this.listenTo(this.collection, 'change:' + this.starredAttribute, (model) => {
+ const rowView = this.getRowView(model.id);
+
+ const element = rowView?.element;
+
+ if (!element) {
+ return;
+ }
+
+ model.attributes[this.starredAttribute] ?
+ element.classList.add('starred') :
+ element.classList.remove('starred');
+ });
+ }
}
/**
@@ -3162,6 +3186,17 @@ class ListRecordView extends View {
});
}
+ /**
+ * Get a row view.
+ *
+ * @protected
+ * @return {import('view').default | null}
+ * @since 10.0.0
+ */
+ getRowView(id) {
+ return /** @type {import('view').default | null} */this.getView(id);
+ }
+
/**
* Build a row.
*
diff --git a/frontend/less/espo/custom.less b/frontend/less/espo/custom.less
index 47fa99e66a..e2b98174a5 100644
--- a/frontend/less/espo/custom.less
+++ b/frontend/less/espo/custom.less
@@ -1390,6 +1390,26 @@ section {
display: inline;
}
+.notification-list,
+#notifications-panel {
+ .list {
+ > .list-group {
+ > .list-group-item {
+ &.starred {
+ &::before {
+ content: " ";
+ position: absolute;
+ top: var(--14px);
+ height: var(--16px);
+ width: var(--3px);
+ background-color: var(--brand-primary);
+ }
+ }
+ }
+ }
+ }
+}
+
.notification-list .expanded-row > .cell[data-name="data"],
#notifications-panel .expanded-row > .cell[data-name="data"] {
padding-left: 0;