diff --git a/client/src/views/notification/items/assign.js b/client/src/views/notification/items/assign.js
index 7caeb48160..9aec034904 100644
--- a/client/src/views/notification/items/assign.js
+++ b/client/src/views/notification/items/assign.js
@@ -42,7 +42,7 @@ define('views/notification/items/assign', ['views/notification/items/base'], fun
this.messageData['entityType'] = Espo.Utils
.upperCaseFirst((this.translate(data.entityType, 'scopeNames') || '').toLowerCase());
- this.messageData['entity'] =
+ this.messageData['html:entity'] =
$('')
.attr('href', '#' + data.entityType + '/view/' + data.entityId)
.text(data.entityName)
@@ -50,7 +50,5 @@ define('views/notification/items/assign', ['views/notification/items/base'], fun
this.createMessage();
},
-
});
});
-
diff --git a/client/src/views/notification/items/base.js b/client/src/views/notification/items/base.js
index 844b073cd5..e1a02e4645 100644
--- a/client/src/views/notification/items/base.js
+++ b/client/src/views/notification/items/base.js
@@ -80,7 +80,7 @@ define('views/notification/items/base', ['view'], function (Dep) {
},
getAvatarHtml: function () {
- var id = this.userId;
+ let id = this.userId;
if (this.isSystemAvatar) {
id = 'system';
diff --git a/client/src/views/notification/items/email-received.js b/client/src/views/notification/items/email-received.js
index 08c3b4fa2f..f3a5f4f00b 100644
--- a/client/src/views/notification/items/email-received.js
+++ b/client/src/views/notification/items/email-received.js
@@ -46,11 +46,11 @@ define('views/notification/items/email-received', ['views/notification/items/bas
this.userId = data.userId;
- this.messageData['entityType'] = Espo.Utils
- .upperCaseFirst((this.translate(data.entityType, 'scopeNames') || '').toLowerCase());
+ this.messageData['entityType'] =
+ Espo.Utils.upperCaseFirst((this.translate(data.entityType, 'scopeNames') || '').toLowerCase());
if (data.personEntityId) {
- this.messageData['from'] =
+ this.messageData['html:from'] =
$('')
.attr('href', '#' + data.personEntityType + '/view/' + data.personEntityId)
.text(data.personEntityName)
@@ -59,7 +59,7 @@ define('views/notification/items/email-received', ['views/notification/items/bas
else {
let text = data.fromString || this.translate('empty address');
- this.messageData['from'] =
+ this.messageData['html:from'] =
$('')
.text(text)
.get(0).outerHTML;
diff --git a/client/src/views/notification/items/entity-removed.js b/client/src/views/notification/items/entity-removed.js
index 5cabb3f77a..ec81f47bc3 100644
--- a/client/src/views/notification/items/entity-removed.js
+++ b/client/src/views/notification/items/entity-removed.js
@@ -39,16 +39,16 @@ define('views/notification/items/entity-removed', ['views/notification/items/bas
this.userId = data.userId;
- this.messageData['entityType'] = Espo.Utils
- .upperCaseFirst((this.translate(data.entityType, 'scopeNames') || '').toLowerCase())
+ this.messageData['entityType'] =
+ Espo.Utils.upperCaseFirst((this.translate(data.entityType, 'scopeNames') || '').toLowerCase())
- this.messageData['user'] =
+ this.messageData['html:user'] =
$('')
.attr('href', '#User/view/' + data.userId)
.text(data.userName)
.get(0).outerHTML;
- this.messageData['entity'] =
+ this.messageData['html:entity'] =
$('')
.attr('href', '#' + data.entityType + '/view/' + data.entityId)
.text(data.entityName)
diff --git a/client/src/views/notification/items/message.js b/client/src/views/notification/items/message.js
index 3772a43b92..103097855e 100644
--- a/client/src/views/notification/items/message.js
+++ b/client/src/views/notification/items/message.js
@@ -26,10 +26,9 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-define(
- 'views/notification/items/message',
- ['views/notification/items/base', 'lib!marked', 'lib!dompurify'],
- function (Dep, marked, DOMPurify) {
+define('views/notification/items/message',
+['views/notification/items/base', 'lib!marked', 'lib!dompurify'],
+function (Dep, marked, DOMPurify) {
return Dep.extend({
@@ -54,16 +53,16 @@ define(
this.userId = data.userId;
- this.messageData['entityType'] = Espo.Utils
- .upperCaseFirst((this.translate(data.entityType, 'scopeNames') || '').toLowerCase())
+ this.messageData['entityType'] =
+ Espo.Utils.upperCaseFirst((this.translate(data.entityType, 'scopeNames') || '').toLowerCase())
- this.messageData['user'] =
+ this.messageData['html:user'] =
$('')
.attr('href', '#User/view/' + data.userId)
.text(data.userName)
.get(0).outerHTML;
- this.messageData['entity'] =
+ this.messageData['html:entity'] =
$('')
.attr('href', '#' + data.entityType + '/view/' + data.entityId)
.text(data.entityName)
diff --git a/client/src/views/notification/items/system.js b/client/src/views/notification/items/system.js
index 6874493179..d243446a5a 100644
--- a/client/src/views/notification/items/system.js
+++ b/client/src/views/notification/items/system.js
@@ -47,4 +47,3 @@ define('views/notification/items/system', ['views/notification/items/base'], fun
},
});
});
-
diff --git a/client/src/views/stream/message.js b/client/src/views/stream/message.js
index 10c10d3a9a..eb35c26b1a 100644
--- a/client/src/views/stream/message.js
+++ b/client/src/views/stream/message.js
@@ -30,21 +30,40 @@ define('views/stream/message', ['view'], function (Dep) {
return Dep.extend({
- setup: function () {
- var template = this.options.messageTemplate;
- var data = this.options.messageData;
+ data: function () {
+ return this.dataForTemplate;
+ },
- for (var key in data) {
- var value = data[key] || '';
+ setup: function () {
+ let template = this.options.messageTemplate;
+ let data = this.options.messageData;
+
+ this.dataForTemplate = {};
+
+ for (let key in data) {
+ let value = data[key] || '';
+
+ if (key.indexOf('html:') === 0) {
+ key = key.substring(5);
+ this.dataForTemplate[key] = value;
+
+ template = template.replace('{' + key + '}', '{{{' + key +'}}}');
+
+ continue;
+ }
if (value.indexOf('field:') === 0) {
- var field = value.substr(6);
+ let field = value.substring(6);
this.createField(key, field);
- template = template.replace('{' + key +'}', '{{{' + key +'}}}');
- } else {
- template = template.replace('{' + key +'}', value);
+ template = template.replace('{' + key + '}', '{{{' + key +'}}}');
+
+ continue;
}
+
+ this.dataForTemplate[key] = value;
+
+ template = template.replace('{' + key + '}', '{{' + key +'}}');
}
this.templateContent = template;
@@ -65,4 +84,3 @@ define('views/stream/message', ['view'], function (Dep) {
},
});
});
-
diff --git a/client/src/views/stream/note.js b/client/src/views/stream/note.js
index 3e7bfd093f..f40d3f2a09 100644
--- a/client/src/views/stream/note.js
+++ b/client/src/views/stream/note.js
@@ -82,10 +82,12 @@ define('views/stream/note', ['view'], function (Dep) {
this.createField('parent');
}
+ let translatedEntityType = this.translateEntityType(this.model.get('parentType'));
+
this.messageData = {
'user': 'field:createdBy',
'entity': 'field:parent',
- 'entityType': this.getHelper().escapeString(this.translateEntityType(this.model.get('parentType'))),
+ 'entityType': translatedEntityType,
};
if (!this.options.noEdit && (this.isEditable || this.isRemovable)) {
diff --git a/client/src/views/stream/notes/assign.js b/client/src/views/stream/notes/assign.js
index c423f21a9b..1b4210797d 100644
--- a/client/src/views/stream/notes/assign.js
+++ b/client/src/views/stream/notes/assign.js
@@ -48,7 +48,7 @@ define('views/stream/notes/assign', ['views/stream/note'], function (Dep) {
this.assignedUserId = data.assignedUserId || null;
this.assignedUserName = data.assignedUserName || null;
- this.messageData['assignee'] = $('')
+ this.messageData['html:assignee'] = $('')
.attr('href', '#User/view/' + data.assignedUserId)
.text(data.assignedUserName)
.get(0).outerHTML;
diff --git a/client/src/views/stream/notes/create-related.js b/client/src/views/stream/notes/create-related.js
index 95f3df7410..a7b9f5dba0 100644
--- a/client/src/views/stream/notes/create-related.js
+++ b/client/src/views/stream/notes/create-related.js
@@ -58,14 +58,14 @@ define('views/stream/notes/create-related', ['views/stream/note'], function (Dep
this.messageData['relatedEntityType'] = this.translateEntityType(this.entityType);
- this.messageData['relatedEntity'] =
+ this.messageData['html:relatedEntity'] =
$('')
.attr('href', '#' + this.entityType + '/view/' + this.entityId)
.text(this.entityName)
.get(0).outerHTML;
+
this.createMessage();
},
});
});
-
diff --git a/client/src/views/stream/notes/create.js b/client/src/views/stream/notes/create.js
index cd7d61529e..771828261a 100644
--- a/client/src/views/stream/notes/create.js
+++ b/client/src/views/stream/notes/create.js
@@ -52,7 +52,7 @@ define('views/stream/notes/create', ['views/stream/note'], function (Dep) {
this.assignedUserId = data.assignedUserId || null;
this.assignedUserName = data.assignedUserName || null;
- this.messageData['assignee'] = $('')
+ this.messageData['html:assignee'] = $('')
.attr('href', '#User/view/' + this.assignedUserId)
.text(this.assignedUserName)
.get(0).outerHTML;
diff --git a/client/src/views/stream/notes/email-received.js b/client/src/views/stream/notes/email-received.js
index 414f662933..740e23d2e0 100644
--- a/client/src/views/stream/notes/email-received.js
+++ b/client/src/views/stream/notes/email-received.js
@@ -76,10 +76,11 @@ define('views/stream/notes/email-received', ['views/stream/note'], function (Dep
}
}
- this.messageData['email'] = $('')
- .attr('href', '#Email/view/' + data.emailId)
- .text(data.emailName)
- .get(0).outerHTML;
+ this.messageData['html:email'] =
+ $('')
+ .attr('href', '#Email/view/' + data.emailId)
+ .text(data.emailName)
+ .get(0).outerHTML;
this.messageName = 'emailReceived';
@@ -90,10 +91,11 @@ define('views/stream/notes/email-received', ['views/stream/note'], function (Dep
if (data.personEntityId) {
this.messageName += 'From';
- this.messageData['from'] = $('')
- .attr('href', '#' + data.personEntityType + '/view/' + data.personEntityId)
- .text(data.personEntityName)
- .get(0).outerHTML;
+ this.messageData['html:from'] =
+ $('')
+ .attr('href', '#' + data.personEntityType + '/view/' + data.personEntityId)
+ .text(data.personEntityName)
+ .get(0).outerHTML;
}
if (
diff --git a/client/src/views/stream/notes/email-sent.js b/client/src/views/stream/notes/email-sent.js
index e746cb82b9..94e43e4e44 100644
--- a/client/src/views/stream/notes/email-sent.js
+++ b/client/src/views/stream/notes/email-sent.js
@@ -68,17 +68,19 @@ define('views/stream/notes/email-sent', ['views/stream/note'], function (Dep) {
}
}
- this.messageData['email'] = $('')
- .attr('href', '#Email/view/' + data.emailId)
- .text(data.emailName)
- .get(0).outerHTML;
+ this.messageData['html:email'] =
+ $('')
+ .attr('href', '#Email/view/' + data.emailId)
+ .text(data.emailName)
+ .get(0).outerHTML;
this.messageName = 'emailSent';
- this.messageData['by'] = $('')
- .attr('href', '#' + data.personEntityType + '/view/' + data.personEntityId)
- .text(data.personEntityName)
- .get(0).outerHTML;
+ this.messageData['html:by'] =
+ $('')
+ .attr('href', '#' + data.personEntityType + '/view/' + data.personEntityId)
+ .text(data.personEntityName)
+ .get(0).outerHTML;
if (this.isThis) {
this.messageName += 'This';
diff --git a/client/src/views/stream/notes/mention-in-post.js b/client/src/views/stream/notes/mention-in-post.js
index c258e7a3e8..578d022855 100644
--- a/client/src/views/stream/notes/mention-in-post.js
+++ b/client/src/views/stream/notes/mention-in-post.js
@@ -107,7 +107,7 @@ define('views/stream/notes/mention-in-post', ['views/stream/note'], function (De
);
});
- this.messageData['target'] = teamHtmlList.join(', ');
+ this.messageData['html:target'] = teamHtmlList.join(', ');
this.createMessage();
@@ -142,7 +142,7 @@ define('views/stream/notes/mention-in-post', ['views/stream/note'], function (De
);
});
- this.messageData['target'] = userHtmlList.join(', ');
+ this.messageData['html:target'] = userHtmlList.join(', ');
this.createMessage();
diff --git a/client/src/views/stream/notes/post.js b/client/src/views/stream/notes/post.js
index 41b6b58bde..3dfb30f474 100644
--- a/client/src/views/stream/notes/post.js
+++ b/client/src/views/stream/notes/post.js
@@ -110,7 +110,7 @@ define('views/stream/notes/post', ['views/stream/note'], function (Dep) {
);
});
- this.messageData['target'] = teamHtmlList.join(', ');
+ this.messageData['html:target'] = teamHtmlList.join(', ');
this.createMessage();
@@ -144,7 +144,7 @@ define('views/stream/notes/post', ['views/stream/note'], function (Dep) {
)
});
- this.messageData['target'] = portalHtmlList.join(', ');
+ this.messageData['html:target'] = portalHtmlList.join(', ');
this.createMessage();
@@ -204,7 +204,7 @@ define('views/stream/notes/post', ['views/stream/note'], function (Dep) {
);
});
- this.messageData['target'] = userHtmlList.join(', ');
+ this.messageData['html:target'] = userHtmlList.join(', ');
this.createMessage();
},
diff --git a/client/src/views/stream/notes/relate.js b/client/src/views/stream/notes/relate.js
index 45ddad23d8..1edf827f3c 100644
--- a/client/src/views/stream/notes/relate.js
+++ b/client/src/views/stream/notes/relate.js
@@ -57,7 +57,7 @@ define('views/stream/notes/relate', ['views/stream/note'], function (Dep) {
this.messageData['relatedEntityType'] = this.translateEntityType(this.entityType);
- this.messageData['relatedEntity'] =
+ this.messageData['html:relatedEntity'] =
$('')
.attr('href', '#' + this.entityType + '/view/' + this.entityId)
.text(this.entityName)