diff --git a/client/src/views/stream/fields/attachment-multiple.js b/client/src/views/stream/fields/attachment-multiple.js
index 656d054532..6ea6908bfa 100644
--- a/client/src/views/stream/fields/attachment-multiple.js
+++ b/client/src/views/stream/fields/attachment-multiple.js
@@ -26,14 +26,12 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-Espo.define('views/stream/fields/attachment-multiple', 'views/fields/attachment-multiple', function (Dep) {
+define('views/stream/fields/attachment-multiple', ['views/fields/attachment-multiple'], function (Dep) {
return Dep.extend({
showPreviews: true,
showPreviewsInListMode: true,
-
});
-
});
diff --git a/client/src/views/stream/fields/post.js b/client/src/views/stream/fields/post.js
index efed525325..5c59bb1ce9 100644
--- a/client/src/views/stream/fields/post.js
+++ b/client/src/views/stream/fields/post.js
@@ -26,27 +26,29 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-define('views/stream/fields/post', 'views/fields/text', function (Dep) {
+define('views/stream/fields/post', ['views/fields/text'], function (Dep) {
return Dep.extend({
getValueForDisplay: function () {
- var text = Dep.prototype.getValueForDisplay.call(this);
+ let text = Dep.prototype.getValueForDisplay.call(this);
- if (this.mode === 'detail' || this.mode === 'list') {
- var mentionData = (this.model.get('data') || {}).mentions || {};
+ if (this.isDetailMode() || this.isListMode()) {
+ let mentionData = (this.model.get('data') || {}).mentions || {};
- Object.keys(mentionData).sort((a, b) => {
- return a.length < b.length;
- }).forEach((item) => {
- var part = '[' + mentionData[item].name + '](#User/view/'+mentionData[item].id + ')';
+ Object
+ .keys(mentionData)
+ .sort((a, b) => {
+ return a.length < b.length;
+ })
+ .forEach(item => {
+ var part = '[' + mentionData[item].name + '](#User/view/'+mentionData[item].id + ')';
- text = text.replace(new RegExp(item, 'g'), part);
- });
+ text = text.replace(new RegExp(item, 'g'), part);
+ });
}
return text;
},
-
});
});
diff --git a/client/src/views/stream/message.js b/client/src/views/stream/message.js
index d1de0f99b0..10c10d3a9a 100644
--- a/client/src/views/stream/message.js
+++ b/client/src/views/stream/message.js
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-Espo.define('views/stream/message', 'view', function (Dep) {
+define('views/stream/message', ['view'], function (Dep) {
return Dep.extend({
@@ -47,11 +47,12 @@ Espo.define('views/stream/message', 'view', function (Dep) {
}
}
- this._template = template;
+ this.templateContent = template;
},
createField: function (key, name, type, params) {
type = type || this.model.getFieldType(name) || 'base';
+
this.createView(key, this.getFieldManager().getViewName(type), {
model: this.model,
defs: {
@@ -59,10 +60,9 @@ Espo.define('views/stream/message', 'view', function (Dep) {
params: params || {}
},
mode: 'detail',
- readOnly: true
+ readOnly: true,
});
- }
-
+ },
});
});
diff --git a/client/src/views/stream/modals/create-post.js b/client/src/views/stream/modals/create-post.js
index 60464d67ba..5b46eb9f55 100644
--- a/client/src/views/stream/modals/create-post.js
+++ b/client/src/views/stream/modals/create-post.js
@@ -26,11 +26,11 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-define('views/stream/modals/create-post', 'views/modal', function (Dep) {
+define('views/stream/modals/create-post', ['views/modal'], function (Dep) {
return Dep.extend({
- _template: '
{{{record}}}
',
+ templateContent: '{{{record}}}
',
setup: function () {
this.headerHtml = this.translate('Create Post');
@@ -56,7 +56,7 @@ define('views/stream/modals/create-post', 'views/modal', function (Dep) {
this.createView('record', 'views/stream/record/edit', {
model: model,
el: this.options.el + ' .record',
- }, (view) => {
+ }, view => {
this.listenTo(view, 'after:save', () => {
this.trigger('after:save');
});
@@ -72,6 +72,5 @@ define('views/stream/modals/create-post', 'views/modal', function (Dep) {
actionPost: function () {
this.getView('record').save();
},
-
});
-});
\ No newline at end of file
+});
diff --git a/client/src/views/stream/note.js b/client/src/views/stream/note.js
index 91e8382b31..3e7bfd093f 100644
--- a/client/src/views/stream/note.js
+++ b/client/src/views/stream/note.js
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-Espo.define('views/stream/note', 'view', function (Dep) {
+define('views/stream/note', ['view'], function (Dep) {
return Dep.extend({
@@ -62,8 +62,8 @@ Espo.define('views/stream/note', 'view', function (Dep) {
if (!this.isUserStream) {
if (this.parentModel) {
if (
- this.parentModel.name != this.model.get('parentType') ||
- this.parentModel.id != this.model.get('parentId')
+ this.parentModel.name !== this.model.get('parentType') ||
+ this.parentModel.id !== this.model.get('parentId')
) {
this.isThis = false;
}
@@ -115,25 +115,29 @@ Espo.define('views/stream/note', 'view', function (Dep) {
if (~['de_DE', 'nl_NL'].indexOf(language)) {
string = Espo.Utils.upperCaseFirst(string);
}
+
return string;
},
createField: function (name, type, params, view, options) {
type = type || this.model.getFieldType(name) || 'base';
- var o = {
+
+ let o = {
model: this.model,
defs: {
name: name,
params: params || {}
},
el: this.options.el + ' .cell-' + name,
- mode: 'list'
+ mode: 'list',
};
+
if (options) {
for (var i in options) {
o[i] = options[i];
}
}
+
this.createView(name, view || this.getFieldManager().getViewName(type), o);
},
@@ -147,23 +151,25 @@ Espo.define('views/stream/note', 'view', function (Dep) {
createMessage: function () {
if (!this.messageTemplate) {
- var isTranslated = false;
-
- var parentType = this.model.get('parentType');
+ let isTranslated = false;
+ let parentType = this.model.get('parentType') || null;
if (this.isMale()) {
- this.messageTemplate = this.translate(this.messageName, 'streamMessagesMale', parentType || null) || '';
+ this.messageTemplate = this.translate(this.messageName, 'streamMessagesMale', parentType) || '';
+
if (this.messageTemplate !== this.messageName) {
isTranslated = true;
}
} else if (this.isFemale()) {
- this.messageTemplate = this.translate(this.messageName, 'streamMessagesFemale', parentType || null) || '';
+ this.messageTemplate = this.translate(this.messageName, 'streamMessagesFemale', parentType) || '';
+
if (this.messageTemplate !== this.messageName) {
isTranslated = true;
}
}
+
if (!isTranslated) {
- this.messageTemplate = this.translate(this.messageName, 'streamMessages', parentType || null) || '';
+ this.messageTemplate = this.translate(this.messageName, 'streamMessages', parentType) || '';
}
}
@@ -171,24 +177,40 @@ Espo.define('views/stream/note', 'view', function (Dep) {
messageTemplate: this.messageTemplate,
el: this.options.el + ' .message',
model: this.model,
- messageData: this.messageData
+ messageData: this.messageData,
});
},
getAvatarHtml: function () {
- var id = this.model.get('createdById');
+ let id = this.model.get('createdById');
+
if (this.isSystemAvatar) {
id = 'system';
}
+
return this.getHelper().getAvatarHtml(id, 'small', 20);
},
getIconHtml: function (scope, id) {
- if (this.isThis && scope === this.parentModel.name) return;
- var iconClass = this.getMetadata().get(['clientDefs', scope, 'iconClass']);
- if (!iconClass) return;
- return '';
- }
+ if (this.isThis && scope === this.parentModel.name) {
+ return;
+ }
+ let iconClass = this.getMetadata().get(['clientDefs', scope, 'iconClass']);
+
+ if (!iconClass) {
+ return;
+ }
+
+ return $('')
+ .addClass(iconClass)
+ .addClass('action text-muted icon')
+ .css('cursor', 'pointer')
+ .attr('title', this.translate('View'))
+ .attr('data-action', 'quickView')
+ .attr('data-id', id)
+ .attr('data-scope', scope)
+ .get(0).outerHTML;
+ },
});
});
diff --git a/client/src/views/stream/notes/assign.js b/client/src/views/stream/notes/assign.js
index 0409de2aff..c423f21a9b 100644
--- a/client/src/views/stream/notes/assign.js
+++ b/client/src/views/stream/notes/assign.js
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-Espo.define('views/stream/notes/assign', 'views/stream/note', function (Dep) {
+define('views/stream/notes/assign', ['views/stream/note'], function (Dep) {
return Dep.extend({
@@ -34,32 +34,31 @@ Espo.define('views/stream/notes/assign', 'views/stream/note', function (Dep) {
messageName: 'assign',
- data: function () {
- return _.extend({
- }, Dep.prototype.data.call(this));
- },
-
init: function () {
if (this.getUser().isAdmin()) {
this.isRemovable = true;
}
+
Dep.prototype.init.call(this);
},
setup: function () {
- var data = this.model.get('data');
+ let data = this.model.get('data');
this.assignedUserId = data.assignedUserId || null;
this.assignedUserName = data.assignedUserName || null;
- this.messageData['assignee'] = '' + this.getHelper().escapeString(data.assignedUserName) + '';
+ this.messageData['assignee'] = $('')
+ .attr('href', '#User/view/' + data.assignedUserId)
+ .text(data.assignedUserName)
+ .get(0).outerHTML;
if (this.isUserStream) {
if (this.assignedUserId) {
- if (this.assignedUserId == this.model.get('createdById')) {
+ if (this.assignedUserId === this.model.get('createdById')) {
this.messageName += 'Self';
} else {
- if (this.assignedUserId == this.getUser().id) {
+ if (this.assignedUserId === this.getUser().id) {
this.messageName += 'You';
}
}
@@ -68,7 +67,7 @@ Espo.define('views/stream/notes/assign', 'views/stream/note', function (Dep) {
}
} else {
if (this.assignedUserId) {
- if (this.assignedUserId == this.model.get('createdById')) {
+ if (this.assignedUserId === this.model.get('createdById')) {
this.messageName += 'Self';
}
} else {
@@ -78,7 +77,5 @@ Espo.define('views/stream/notes/assign', 'views/stream/note', function (Dep) {
this.createMessage();
},
-
});
});
-
diff --git a/client/src/views/stream/notes/create-related.js b/client/src/views/stream/notes/create-related.js
index 340dfdf205..18f73df861 100644
--- a/client/src/views/stream/notes/create-related.js
+++ b/client/src/views/stream/notes/create-related.js
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-Espo.define('views/stream/notes/create-related', 'views/stream/note', function (Dep) {
+define('views/stream/notes/create-related', ['views/stream/note'], function (Dep) {
return Dep.extend({
@@ -37,7 +37,7 @@ Espo.define('views/stream/notes/create-related', 'views/stream/note', function (
data: function () {
return _.extend({
relatedTypeString: this.translateEntityType(this.entityType),
- iconHtml: this.getIconHtml(this.entityType, this.entityId)
+ iconHtml: this.getIconHtml(this.entityType, this.entityId),
}, Dep.prototype.data.call(this));
},
@@ -45,21 +45,26 @@ Espo.define('views/stream/notes/create-related', 'views/stream/note', function (
if (this.getUser().isAdmin()) {
this.isRemovable = true;
}
+
Dep.prototype.init.call(this);
},
setup: function () {
- var data = this.model.get('data') || {};
+ let data = this.model.get('data') || {};
this.entityType = this.model.get('relatedType') || data.entityType || null;
this.entityId = this.model.get('relatedId') || data.entityId || null;
this.entityName = this.model.get('relatedName') || data.entityName || null;
this.messageData['relatedEntityType'] = this.translateEntityType(this.entityType);
- this.messageData['relatedEntity'] = '' + this.getHelper().escapeString(this.entityName) +'';
+
+ this.messageData['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 c944af613f..cd7d61529e 100644
--- a/client/src/views/stream/notes/create.js
+++ b/client/src/views/stream/notes/create.js
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-Espo.define('views/stream/notes/create', 'views/stream/note', function (Dep) {
+define('views/stream/notes/create', ['views/stream/note'], function (Dep) {
return Dep.extend({
@@ -47,16 +47,20 @@ Espo.define('views/stream/notes/create', 'views/stream/note', function (Dep) {
setup: function () {
if (this.model.get('data')) {
- var data = this.model.get('data');
+ let data = this.model.get('data');
this.assignedUserId = data.assignedUserId || null;
this.assignedUserName = data.assignedUserName || null;
- this.messageData['assignee'] = '' + this.getHelper().escapeString(this.assignedUserName) + '';
+ this.messageData['assignee'] = $('')
+ .attr('href', '#User/view/' + this.assignedUserId)
+ .text(this.assignedUserName)
+ .get(0).outerHTML;
+
+ let isYou = false;
- var isYou = false;
if (this.isUserStream) {
- if (this.assignedUserId == this.getUser().id) {
+ if (this.assignedUserId === this.getUser().id) {
isYou = true;
}
}
@@ -67,11 +71,11 @@ Espo.define('views/stream/notes/create', 'views/stream/note', function (Dep) {
if (this.isThis) {
this.messageName += 'This';
- if (this.assignedUserId == this.model.get('createdById')) {
+ if (this.assignedUserId === this.model.get('createdById')) {
this.messageName += 'Self';
}
} else {
- if (this.assignedUserId == this.model.get('createdById')) {
+ if (this.assignedUserId === this.model.get('createdById')) {
this.messageName += 'Self';
} else {
if (isYou) {
@@ -82,10 +86,12 @@ Espo.define('views/stream/notes/create', 'views/stream/note', function (Dep) {
}
if (data.statusField) {
- var statusField = this.statusField = data.statusField;
- var statusValue = data.statusValue;
+ let statusField = this.statusField = data.statusField;
+ let statusValue = data.statusValue;
+
this.statusStyle = data.statusStyle || 'default';
- this.statusText = this.getLanguage().translateOption(statusValue, statusField, this.model.get('parentType'));
+ this.statusText = this.getLanguage()
+ .translateOption(statusValue, statusField, this.model.get('parentType'));
}
}
diff --git a/client/src/views/stream/notes/email-received.js b/client/src/views/stream/notes/email-received.js
index 0edcd2e8ec..414f662933 100644
--- a/client/src/views/stream/notes/email-received.js
+++ b/client/src/views/stream/notes/email-received.js
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-Espo.define('views/stream/notes/email-received', 'views/stream/note', function (Dep) {
+define('views/stream/notes/email-received', ['views/stream/note'], function (Dep) {
return Dep.extend({
@@ -53,21 +53,33 @@ Espo.define('views/stream/notes/email-received', 'views/stream/note', function (
this.emailName = data.emailName;
if (
- this.parentModel
- &&
- (this.model.get('parentType') == this.parentModel.name && this.model.get('parentId') == this.parentModel.id)
+ this.parentModel &&
+ (
+ this.model.get('parentType') === this.parentModel.name &&
+ this.model.get('parentId') === this.parentModel.id
+ )
) {
if (this.model.get('post')) {
this.createField('post', null, null, 'views/stream/fields/post');
this.hasPost = true;
}
+
if ((this.model.get('attachmentsIds') || []).length) {
- this.createField('attachments', 'attachmentMultiple', {}, 'views/stream/fields/attachment-multiple');
+ this.createField(
+ 'attachments',
+ 'attachmentMultiple',
+ {},
+ 'views/stream/fields/attachment-multiple'
+ );
+
this.hasAttachments = true;
}
}
- this.messageData['email'] = '' + this.getHelper().escapeString(data.emailName) + '';
+ this.messageData['email'] = $('')
+ .attr('href', '#Email/view/' + data.emailId)
+ .text(data.emailName)
+ .get(0).outerHTML;
this.messageName = 'emailReceived';
@@ -77,10 +89,17 @@ Espo.define('views/stream/notes/email-received', 'views/stream/note', function (
if (data.personEntityId) {
this.messageName += 'From';
- this.messageData['from'] = '' + this.getHelper().escapeString(data.personEntityName) + '';
+
+ this.messageData['from'] = $('')
+ .attr('href', '#' + data.personEntityType + '/view/' + data.personEntityId)
+ .text(data.personEntityName)
+ .get(0).outerHTML;
}
- if (this.model.get('parentType') === data.personEntityType && this.model.get('parentId') == data.personEntityId) {
+ if (
+ this.model.get('parentType') === data.personEntityType &&
+ this.model.get('parentId') === data.personEntityId
+ ) {
this.isThis = true;
}
@@ -90,7 +109,6 @@ Espo.define('views/stream/notes/email-received', 'views/stream/note', function (
this.createMessage();
},
-
});
});
diff --git a/client/src/views/stream/notes/email-sent.js b/client/src/views/stream/notes/email-sent.js
index 65e48d3b78..e746cb82b9 100644
--- a/client/src/views/stream/notes/email-sent.js
+++ b/client/src/views/stream/notes/email-sent.js
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-Espo.define('views/stream/notes/email-sent', 'views/stream/note', function (Dep) {
+define('views/stream/notes/email-sent', ['views/stream/note'], function (Dep) {
return Dep.extend({
@@ -51,26 +51,34 @@ Espo.define('views/stream/notes/email-sent', 'views/stream/note', function (Dep)
this.emailName = data.emailName;
if (
- this.parentModel
- &&
- (this.model.get('parentType') == this.parentModel.name && this.model.get('parentId') == this.parentModel.id)
+ this.parentModel &&
+ (
+ this.model.get('parentType') === this.parentModel.name &&
+ this.model.get('parentId') === this.parentModel.id
+ )
) {
if (this.model.get('post')) {
this.createField('post', null, null, 'views/stream/fields/post');
this.hasPost = true;
}
+
if ((this.model.get('attachmentsIds') || []).length) {
this.createField('attachments', 'attachmentMultiple', {}, 'views/stream/fields/attachment-multiple');
this.hasAttachments = true;
}
}
- this.messageData['email'] = '' + this.getHelper().escapeString(data.emailName) + '';
+ this.messageData['email'] = $('')
+ .attr('href', '#Email/view/' + data.emailId)
+ .text(data.emailName)
+ .get(0).outerHTML;
this.messageName = 'emailSent';
- this.messageData['by'] = '' + this.getHelper().escapeString(data.personEntityName) + '';
-
+ this.messageData['by'] = $('')
+ .attr('href', '#' + data.personEntityType + '/view/' + data.personEntityId)
+ .text(data.personEntityName)
+ .get(0).outerHTML;
if (this.isThis) {
this.messageName += 'This';
@@ -78,6 +86,5 @@ Espo.define('views/stream/notes/email-sent', 'views/stream/note', function (Dep)
this.createMessage();
},
-
});
});
diff --git a/client/src/views/stream/notes/mention-in-post.js b/client/src/views/stream/notes/mention-in-post.js
index dc05ed9bd6..814f660765 100644
--- a/client/src/views/stream/notes/mention-in-post.js
+++ b/client/src/views/stream/notes/mention-in-post.js
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-Espo.define('views/stream/notes/mention-in-post', 'views/stream/note', function (Dep) {
+define('views/stream/notes/mention-in-post', ['views/stream/note'], function (Dep) {
return Dep.extend({
@@ -35,9 +35,11 @@ Espo.define('views/stream/notes/mention-in-post', 'views/stream/note', function
messageName: 'mentionInPost',
data: function () {
- var data = Dep.prototype.data.call(this);
+ let data = Dep.prototype.data.call(this);
+
data.showAttachments = !!(this.model.get('attachmentsIds') || []).length;
data.showPost = !!this.model.get('post');
+
return data;
},
@@ -45,71 +47,114 @@ Espo.define('views/stream/notes/mention-in-post', 'views/stream/note', function
if (this.model.get('post')) {
this.createField('post', null, null, 'views/stream/fields/post');
}
+
if ((this.model.get('attachmentsIds') || []).length) {
this.createField('attachments', 'attachmentMultiple', {}, 'views/stream/fields/attachment-multiple', {
previewSize: this.options.isNotification ? 'small' : null
});
}
- var data = this.model.get('data');
-
this.messageData['mentioned'] = this.options.userId;
if (!this.model.get('parentId')) {
this.messageName = 'mentionInPostTarget';
}
- if (this.isUserStream) {
- if (this.options.userId == this.getUser().id) {
- if (!this.model.get('parentId')) {
- this.messageName = 'mentionYouInPostTarget';
- if (this.model.get('isGlobal')) {
- this.messageName = 'mentionYouInPostTargetAll';
- } else {
- this.messageName = 'mentionYouInPostTarget';
- if (this.model.has('teamsIds') && this.model.get('teamsIds').length) {
- var teamIdList = this.model.get('teamsIds');
- var teamNameHash = this.model.get('teamsNames') || {};
+ if (!this.isUserStream || this.options.userId !== this.getUser().id) {
+ this.createMessage();
- var targetHtml = '';
- var teamHtmlList = [];
- teamIdList.forEach(function (teamId) {
- var teamName = teamNameHash[teamId];
- if (teamName) {
- teamHtmlList.push('' + this.getHelper().escapeString(teamName) + '');
- }
- }, this);
+ return;
+ }
- this.messageData['target'] = teamHtmlList.join(', ');
- } else if (this.model.has('usersIds') && this.model.get('usersIds').length) {
- var userIdList = this.model.get('usersIds');
- var userNameHash = this.model.get('usersNames') || {};
+ if (this.model.get('parentId')) {
+ this.messageName = 'mentionYouInPost';
- if (userIdList.length === 1 && userIdList[0] === this.model.get('createdById')) {
- this.messageName = 'mentionYouInPostTargetNoTarget';
- } else {
- var userHtml = '';
- var userHtmlList = [];
- userIdList.forEach(function (userId) {
- var userName = userNameHash[userId];
- if (userName) {
- userHtmlList.push('' + this.getHelper().escapeString(userName) + '');
- }
- }, this);
- this.messageData['target'] = userHtmlList.join(', ');
- }
- } else if (this.model.get('targetType') === 'self') {
- this.messageName = 'mentionYouInPostTargetNoTarget';
- }
- }
- } else {
- this.messageName = 'mentionYouInPost';
+ this.createMessage();
+
+ return;
+ }
+
+ this.messageName = 'mentionYouInPostTarget';
+
+ if (this.model.get('isGlobal')) {
+ this.messageName = 'mentionYouInPostTargetAll';
+
+ this.createMessage();
+
+ return;
+ }
+
+ this.messageName = 'mentionYouInPostTarget';
+
+ if (this.model.has('teamsIds') && this.model.get('teamsIds').length) {
+ let teamIdList = this.model.get('teamsIds');
+ let teamNameHash = this.model.get('teamsNames') || {};
+
+ let teamHtmlList = [];
+
+ teamIdList.forEach(teamId => {
+ let teamName = teamNameHash[teamId];
+
+ if (!teamName) {
+ return;
}
+
+ teamHtmlList.push(
+ $('')
+ .attr('href', '#Team/view/' + teamId)
+ .text(teamName)
+ .get(0).outerHTML
+ );
+ });
+
+ this.messageData['target'] = teamHtmlList.join(', ');
+
+ this.createMessage();
+
+ return;
+ }
+
+ if (this.model.has('usersIds') && this.model.get('usersIds').length) {
+ var userIdList = this.model.get('usersIds');
+ var userNameHash = this.model.get('usersNames') || {};
+
+ if (userIdList.length === 1 && userIdList[0] === this.model.get('createdById')) {
+ this.messageName = 'mentionYouInPostTargetNoTarget';
+
+ this.createMessage();
+
+ return;
}
+
+ let userHtmlList = [];
+
+ userIdList.forEach(userId => {
+ let userName = userNameHash[userId];
+
+ if (!userName) {
+ return;
+ }
+
+ userHtmlList.push(
+ $('')
+ .attr('href', '#User/view/' + userId)
+ .text(userName)
+ .get(0).outerHTML
+ );
+ });
+
+ this.messageData['target'] = userHtmlList.join(', ');
+
+ this.createMessage();
+
+ return;
+ }
+
+ if (this.model.get('targetType') === 'self') {
+ this.messageName = 'mentionYouInPostTargetNoTarget';
}
this.createMessage();
- }
-
+ },
});
});
diff --git a/client/src/views/stream/record/edit.js b/client/src/views/stream/record/edit.js
index 40dc25f4e5..194908c77c 100644
--- a/client/src/views/stream/record/edit.js
+++ b/client/src/views/stream/record/edit.js
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-define('views/stream/record/edit', 'views/record/base', function (Dep) {
+define('views/stream/record/edit', ['views/record/base'], function (Dep) {
return Dep.extend({
diff --git a/client/src/views/stream/record/list.js b/client/src/views/stream/record/list.js
index 40867725e0..1b7f99a00c 100644
--- a/client/src/views/stream/record/list.js
+++ b/client/src/views/stream/record/list.js
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-define('views/stream/record/list', 'views/record/list-expanded', function (Dep) {
+define('views/stream/record/list', ['views/record/list-expanded'], function (Dep) {
return Dep.extend({
diff --git a/client/src/views/stream/row-actions/default.js b/client/src/views/stream/row-actions/default.js
index 4a38290e1a..47e77f4264 100644
--- a/client/src/views/stream/row-actions/default.js
+++ b/client/src/views/stream/row-actions/default.js
@@ -26,11 +26,10 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
-Espo.define('views/stream/row-actions/default', 'views/record/row-actions/edit-and-remove', function (Dep) {
+define('views/stream/row-actions/default', ['views/record/row-actions/edit-and-remove'], function (Dep) {
return Dep.extend({
-
getActionList: function () {
var list = [];
@@ -39,8 +38,8 @@ Espo.define('views/stream/row-actions/default', 'views/record/row-actions/edit-a
action: 'quickEdit',
label: 'Edit',
data: {
- id: this.model.id
- }
+ id: this.model.id,
+ },
});
}
@@ -49,14 +48,12 @@ Espo.define('views/stream/row-actions/default', 'views/record/row-actions/edit-a
action: 'quickRemove',
label: 'Remove',
data: {
- id: this.model.id
- }
+ id: this.model.id,
+ },
});
}
return list;
- }
-
+ },
});
});
-