From dcfd7bf7fffb6b7c946011870f1ae8a292937ddd Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Sun, 19 Nov 2017 16:37:37 +0100 Subject: fix avatars in file rows of outgoing shares Signed-off-by: Arthur Schiwon --- core/js/share.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'core/js') diff --git a/core/js/share.js b/core/js/share.js index 25d59b46fb4..44f4f12f833 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -197,6 +197,12 @@ OC.Share = _.extend(OC.Share || {}, { delete OC.Share.statuses[itemSource]; } }, + _formatRegularShare: function(shareWith, shareWithDisplayName, message) { + // display avatar of the user + var avatar = ''; + var hidden = '' + message + ' ' + escapeHTML(shareWithDisplayName) + ' '; + return avatar + hidden; + }, /** * Format a remote address * @@ -207,7 +213,7 @@ OC.Share = _.extend(OC.Share || {}, { var parts = this._REMOTE_OWNER_REGEXP.exec(remoteAddress); if (!parts) { // display avatar of the user - var avatar = ''; + var avatar = ''; var hidden = '' + message + ' ' + escapeHTML(remoteAddress) + ' '; return avatar + hidden; } @@ -243,9 +249,8 @@ OC.Share = _.extend(OC.Share || {}, { */ _formatShareList: function(recipients) { var _parent = this; - return $.map(recipients, function(recipient) { - recipient = _parent._formatRemoteShare(recipient, t('core', 'Shared with')); - return recipient; + return $.map(recipients, function(shareWithDisplayName, shareWith) { + return _parent._formatRegularShare(shareWith, shareWithDisplayName, t('core', 'Shared with')); }); }, /** @@ -291,7 +296,7 @@ OC.Share = _.extend(OC.Share || {}, { } // update share action text / icon if (hasShares || owner) { - recipients = $tr.attr('data-share-recipients'); + recipients = $tr.data('share-recipient-data'); action.addClass('shared-style'); avatars = '' + t('core', 'Shared') + ''; @@ -300,13 +305,15 @@ OC.Share = _.extend(OC.Share || {}, { message = t('core', 'Shared by'); avatars = this._formatRemoteShare(owner, message); } else if (recipients) { - avatars = this._formatShareList(recipients.split(', ')).join(''); + avatars = this._formatShareList(recipients); } action.html(avatars).prepend(icon); if (owner || recipients) { var avatarElement = action.find('.avatar'); - avatarElement.avatar(avatarElement.data('username'), 32); + avatarElement.each(function () { + $(this).avatar($(this).data('username'), 32); + }); action.find('.icon-shared + span').tooltip({placement: 'top'}); } -- cgit v1.2.3