From 8eb19a278c1667b4c8679076b21c1e5e08a77e9d Mon Sep 17 00:00:00 2001 From: Daniel Calviño Sánchez Date: Sun, 26 Nov 2017 23:45:35 +0100 Subject: Disable contacts menu for mentioned users in comments being composed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- apps/comments/css/comments.css | 4 ++-- apps/comments/js/commentstabview.js | 17 ++++++++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/apps/comments/css/comments.css b/apps/comments/css/comments.css index 14fa4316b5a..16855749268 100644 --- a/apps/comments/css/comments.css +++ b/apps/comments/css/comments.css @@ -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; diff --git a/apps/comments/js/commentstabview.js b/apps/comments/js/commentstabview.js index c9fcc72e284..867072c4665 100644 --- a/apps/comments/js/commentstabview.js +++ b/apps/comments/js/commentstabview.js @@ -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')); -- cgit v1.2.3