From 748529afacd73c8bb197cd22352b6629cc44fe18 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Mon, 11 Mar 2024 18:43:55 +0200 Subject: [PATCH] ref --- .../views/notification/fields/container.js | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/client/src/views/notification/fields/container.js b/client/src/views/notification/fields/container.js index e3d8f7398f..837ca0d955 100644 --- a/client/src/views/notification/fields/container.js +++ b/client/src/views/notification/fields/container.js @@ -35,6 +35,14 @@ class NotificationContainerFieldView extends BaseFieldView { listTemplate = 'notification/fields/container' detailTemplate = 'notification/fields/container' + types = [ + 'Assign', + 'EmailReceived', + 'EntityRemoved', + 'Message', + 'System', + ] + setup() { switch (this.model.get('type')) { case 'Note': @@ -61,8 +69,15 @@ class NotificationContainerFieldView extends BaseFieldView { type = type.replace(/ /g, ''); - const viewName = this.getMetadata().get(`clientDefs.Notification.itemViews.${type}`) || - 'views/notification/items/' + Espo.Utils.camelCaseToHyphen(type); + let viewName = this.getMetadata().get(`clientDefs.Notification.itemViews.${type}`); + + if (!viewName) { + if (!this.types.includes(type)) { + return; + } + + viewName = 'views/notification/items/' + Espo.Utils.camelCaseToHyphen(type); + } this.createView('notification', viewName, { model: this.model, @@ -80,8 +95,12 @@ class NotificationContainerFieldView extends BaseFieldView { this.getModelFactory().create('Note', model => { model.set(data); - const viewName = this.getMetadata().get(`clientDefs.Note.itemViews.${data.type}`) || - 'views/stream/notes/' + Espo.Utils.camelCaseToHyphen(data.type); + let viewName = this.getMetadata().get(`clientDefs.Note.itemViews.${data.type}`); + + if (!viewName) { + // @todo Ceck if type exists. + viewName = 'views/stream/notes/' + Espo.Utils.camelCaseToHyphen(data.type); + } this.createView('notification', viewName, { model: model,