Disable contacts menu for mentioned users in comments being composed

The contacts menu does not provide too much value for users mentioned in
a message being composed, so it is now disabled in this case.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2017-11-26 23:45:35 +01:00
parent 107952ff00
commit 8eb19a278c
2 changed files with 14 additions and 7 deletions

View File

@ -127,8 +127,8 @@
position: relative;
}
#commentsTabView .comment .message .avatar-name-wrapper,
#commentsTabView .comment .message .avatar-name-wrapper .avatar,
#commentsTabView .comment:not(.newCommentRow) .message .avatar-name-wrapper,
#commentsTabView .comment:not(.newCommentRow) .message .avatar-name-wrapper .avatar,
#commentsTabView .comment .authorRow .avatar:not(.currentUser),
#commentsTabView .comment .authorRow .author:not(.currentUser) {
cursor: pointer;

View File

@ -214,13 +214,15 @@
searchKey: "label"
});
$target.on('inserted.atwho', function (je, $el) {
var editionMode = true;
s._postRenderItem(
// we need to pass the parent of the inserted element
// passing the whole comments form would re-apply and request
// avatars from the server
$(je.target).find(
'div[data-username="' + $el.find('[data-username]').data('username') + '"]'
).parent()
).parent(),
editionMode
);
});
},
@ -377,7 +379,7 @@
});
},
_postRenderItem: function($el) {
_postRenderItem: function($el, editionMode) {
$el.find('.has-tooltip').tooltip();
$el.find('.avatar').each(function() {
var $this = $(this);
@ -395,10 +397,14 @@
// it is the case when writing a comment and mentioning a person
$message = $el;
}
this._postRenderMessage($message);
this._postRenderMessage($message, editionMode);
},
_postRenderMessage: function($el) {
_postRenderMessage: function($el, editionMode) {
if (editionMode) {
return;
}
$el.find('.avatar').each(function() {
var avatar = $(this);
var strong = $(this).next();
@ -486,7 +492,8 @@
.html(this._formatMessage(commentToEdit.get('message'), commentToEdit.get('mentions')))
.find('.avatar')
.each(function () { $(this).avatar(); });
this._postRenderItem($message);
var editionMode = true;
this._postRenderItem($message, editionMode);
// Enable autosize
autosize($formRow.find('.message'));