summaryrefslogtreecommitdiffstats
path: root/apps/comments
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2017-04-26 18:31:17 +0200
committerGitHub <noreply@github.com>2017-04-26 18:31:17 +0200
commitd89c76049fbc7061bfa45e87c46f08802242d5f2 (patch)
tree0aa8bdbad51349e6e6081fd3fe24945950433e03 /apps/comments
parentedd9444209ec8f0737821870fa9a25b7fe5dc0e6 (diff)
parent6bbc682c4b24212d36ef595d3692653dca1c67b1 (diff)
downloadnextcloud-server-d89c76049fbc7061bfa45e87c46f08802242d5f2.tar.gz
nextcloud-server-d89c76049fbc7061bfa45e87c46f08802242d5f2.zip
Merge pull request #4374 from nextcloud/contactsmenu_popover
add contacts popover
Diffstat (limited to 'apps/comments')
-rw-r--r--apps/comments/css/comments.css6
-rw-r--r--apps/comments/js/commentstabview.js20
-rw-r--r--apps/comments/tests/js/commentstabviewSpec.js2
3 files changed, 25 insertions, 3 deletions
diff --git a/apps/comments/css/comments.css b/apps/comments/css/comments.css
index 796a550227b..2d794d52708 100644
--- a/apps/comments/css/comments.css
+++ b/apps/comments/css/comments.css
@@ -54,7 +54,6 @@
#commentsTabView .comment {
position: relative;
- z-index: 1;
margin-bottom: 30px;
}
@@ -108,6 +107,11 @@
vertical-align: middle;
}
+#commentsTabView .authorRow>div.hidden {
+ display: none !important;
+}
+
+#commentsTabView .comments li .message .avatar-name-wrapper,
#commentsTabView .comment .authorRow {
position: relative;
}
diff --git a/apps/comments/js/commentstabview.js b/apps/comments/js/commentstabview.js
index 2256bea943e..ace0862ad2e 100644
--- a/apps/comments/js/commentstabview.js
+++ b/apps/comments/js/commentstabview.js
@@ -232,6 +232,21 @@
var $this = $(this);
$this.avatar($this.attr('data-username'), 32);
});
+
+ var username = $el.find('.avatar').data('username');
+ if (username !== oc_current_user) {
+ $el.find('.authorRow .avatar, .authorRow .author').contactsMenu(
+ username, 0, $el.find('.authorRow'));
+ }
+
+ var message = $el.find('.message');
+ message.find('.avatar').each(function() {
+ var avatar = $(this);
+ var strong = $(this).next();
+ var appendTo = $(this).parent();
+
+ $.merge(avatar, strong).contactsMenu(avatar.data('user'), 0, appendTo);
+ });
},
/**
@@ -251,7 +266,10 @@
// escape possible regex characters in the name
mention = mention.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
- var displayName = avatar + ' <strong>'+ _.escape(mentions[i].mentionDisplayName)+'</strong>';
+ var displayName = ''
+ + '<span class="avatar-name-wrapper">'
+ + avatar + ' <strong>'+ _.escape(mentions[i].mentionDisplayName)+'</strong>'
+ + '</span>';
// replace every mention either at the start of the input or after a whitespace
// followed by a non-word character.
diff --git a/apps/comments/tests/js/commentstabviewSpec.js b/apps/comments/tests/js/commentstabviewSpec.js
index 0bbfaa1f295..c961548d806 100644
--- a/apps/comments/tests/js/commentstabviewSpec.js
+++ b/apps/comments/tests/js/commentstabviewSpec.js
@@ -153,7 +153,7 @@ describe('OCA.Comments.CommentsTabView tests', function() {
expect($comment.find('strong:first').text()).toEqual('Thane of Cawdor');
expect($comment.find('.avatar[data-user=banquo]').length).toEqual(1);
- expect($comment.find('strong:last-child').text()).toEqual('Lord Banquo');
+ expect($comment.find('.avatar-name-wrapper:last-child strong').text()).toEqual('Lord Banquo');
});
});