Fix avatars in file rows of incoming shares

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
Arthur Schiwon 2017-11-19 16:38:04 +01:00
parent dcfd7bf7ff
commit 4247936dd6
No known key found for this signature in database
GPG Key ID: 7424F1874854DF23
3 changed files with 8 additions and 5 deletions

View File

@ -46,6 +46,7 @@
tr.attr('data-share-permissions', sharePermissions); tr.attr('data-share-permissions', sharePermissions);
if (fileData.shareOwner) { if (fileData.shareOwner) {
tr.attr('data-share-owner', fileData.shareOwner); tr.attr('data-share-owner', fileData.shareOwner);
tr.attr('data-share-owner-id', fileData.shareOwnerId);
// user should always be able to rename a mount point // user should always be able to rename a mount point
if (fileData.mountType === 'shared-root') { if (fileData.mountType === 'shared-root') {
tr.attr('data-permissions', fileData.permissions | OC.PERMISSION_UPDATE); tr.attr('data-permissions', fileData.permissions | OC.PERMISSION_UPDATE);

View File

@ -297,6 +297,7 @@
}; };
if (self._sharedWithUser) { if (self._sharedWithUser) {
file.shareOwner = share.displayname_owner; file.shareOwner = share.displayname_owner;
file.shareOwnerId = share.uid_owner;
file.name = OC.basename(share.file_target); file.name = OC.basename(share.file_target);
file.path = OC.dirname(share.file_target); file.path = OC.dirname(share.file_target);
file.permissions = share.permissions; file.permissions = share.permissions;

View File

@ -266,12 +266,13 @@ OC.Share = _.extend(OC.Share || {}, {
var type = $tr.data('type'); var type = $tr.data('type');
var icon = action.find('.icon'); var icon = action.find('.icon');
var message, recipients, avatars; var message, recipients, avatars;
var ownerId = $tr.attr('data-share-owner-id');
var owner = $tr.attr('data-share-owner'); var owner = $tr.attr('data-share-owner');
var shareFolderIcon; var shareFolderIcon;
var iconClass = 'icon-shared'; var iconClass = 'icon-shared';
action.removeClass('shared-style'); action.removeClass('shared-style');
// update folder icon // update folder icon
if (type === 'dir' && (hasShares || hasLink || owner)) { if (type === 'dir' && (hasShares || hasLink || ownerId)) {
if (hasLink) { if (hasLink) {
shareFolderIcon = OC.MimeType.getIconUrl('dir-public'); shareFolderIcon = OC.MimeType.getIconUrl('dir-public');
} }
@ -295,21 +296,21 @@ OC.Share = _.extend(OC.Share || {}, {
$tr.find('.filename .thumbnail').css('background-image', 'url(' + shareFolderIcon + ')'); $tr.find('.filename .thumbnail').css('background-image', 'url(' + shareFolderIcon + ')');
} }
// update share action text / icon // update share action text / icon
if (hasShares || owner) { if (hasShares || ownerId) {
recipients = $tr.data('share-recipient-data'); recipients = $tr.data('share-recipient-data');
action.addClass('shared-style'); action.addClass('shared-style');
avatars = '<span>' + t('core', 'Shared') + '</span>'; avatars = '<span>' + t('core', 'Shared') + '</span>';
// even if reshared, only show "Shared by" // even if reshared, only show "Shared by"
if (owner) { if (ownerId) {
message = t('core', 'Shared by'); message = t('core', 'Shared by');
avatars = this._formatRemoteShare(owner, message); avatars = this._formatRegularShare(ownerId, owner, message);
} else if (recipients) { } else if (recipients) {
avatars = this._formatShareList(recipients); avatars = this._formatShareList(recipients);
} }
action.html(avatars).prepend(icon); action.html(avatars).prepend(icon);
if (owner || recipients) { if (ownerId || recipients) {
var avatarElement = action.find('.avatar'); var avatarElement = action.find('.avatar');
avatarElement.each(function () { avatarElement.each(function () {
$(this).avatar($(this).data('username'), 32); $(this).avatar($(this).data('username'), 32);