diff --git a/apps/comments/css/comments.css b/apps/comments/css/comments.css index 1ed418df2fc66..4ca415c3b020f 100644 --- a/apps/comments/css/comments.css +++ b/apps/comments/css/comments.css @@ -125,6 +125,17 @@ .atwho-view-ul * .avatar-name-wrapper, #commentsTabView .comment .authorRow { position: relative; +} + +#commentsTabView .comment:not(.newCommentRow) .message .avatar-name-wrapper:not(.currentUser), +#commentsTabView .comment:not(.newCommentRow) .message .avatar-name-wrapper:not(.currentUser) .avatar, +#commentsTabView .comment .authorRow .avatar:not(.currentUser), +#commentsTabView .comment .authorRow .author:not(.currentUser) { + cursor: pointer; +} + +.atwho-view-ul .avatar-name-wrapper, +.atwho-view-ul .avatar-name-wrapper .avatar { cursor: pointer; } diff --git a/apps/comments/js/commentstabview.js b/apps/comments/js/commentstabview.js index 7398a709421d5..c48a971dfe6d9 100644 --- a/apps/comments/js/commentstabview.js +++ b/apps/comments/js/commentstabview.js @@ -23,8 +23,8 @@ var EDIT_COMMENT_TEMPLATE = '
' + '
' + - '
' + - '
{{actorDisplayName}}
' + + '
' + + '
{{actorDisplayName}}
' + '{{#if isEditMode}}' + ' ' + '{{/if}}' + @@ -42,8 +42,8 @@ var COMMENT_TEMPLATE = '
  • ' + '
    ' + - '
    ' + - '
    {{actorDisplayName}}
    ' + + '
    ' + + '
    {{actorDisplayName}}
    ' + '{{#if isUserAuthor}}' + ' ' + '{{/if}}' + @@ -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,16 +397,23 @@ // 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(); var appendTo = $(this).parent(); - $.merge(avatar, strong).contactsMenu(avatar.data('user'), 0, appendTo); + var username = $(this).data('username'); + if (username !== oc_current_user) { + $.merge(avatar, strong).contactsMenu(avatar.data('user'), 0, appendTo); + } }); }, @@ -445,9 +454,11 @@ + ' data-user-display-name="' + _.escape(displayName) + '">
    '; + var isCurrentUser = (uid === OC.getCurrentUser().uid); + return '' + '' - + '' + + '' + avatar + ' '+ _.escape(displayName)+'' + '' + ''; @@ -486,7 +497,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'));