From 07f1b263c99b67730fb054482eb241bfad280d57 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Wed, 4 Jun 2014 10:37:04 +0200 Subject: Use recipient display names when updating shares in the UI Since OC.Share didn't have any array containing the list of shares for the current file, OC.Share.currentShares has been introduced to contain the full share item structure instead of the reduced one OC.Share.itemShares. The event "sharesChanged" is now passing OC.Share.currentShares, which itself includes the display name to be displayed for the recipients in the action icon. --- apps/files_sharing/js/share.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'apps/files_sharing/js') diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js index 8a63593883b..e833612fb51 100644 --- a/apps/files_sharing/js/share.js +++ b/apps/files_sharing/js/share.js @@ -75,7 +75,9 @@ OCA.Sharing.sharesLoaded = true; } else{ - // this will update the icons for all the visible elements + // this will update the icons for all the currently visible elements + // additionally added elements when scrolling down will be + // updated in the _renderRow override OC.Share.updateIcons('file', fileList); } }); @@ -113,11 +115,11 @@ OC.Share.showDropDown(itemType, $tr.data('id'), appendTo, true, possiblePermissions, filename); } $('#dropdown').on('sharesChanged', function(ev) { + var recipients = _.pluck(ev.shares[OC.Share.SHARE_TYPE_USER], 'share_with_displayname'); + var groupRecipients = _.pluck(ev.shares[OC.Share.SHARE_TYPE_GROUP], 'share_with_displayname'); + recipients = recipients.concat(groupRecipients); // note: we only update the data attribute because updateIcon() // is called automatically after this event - var userShares = ev.itemShares[OC.Share.SHARE_TYPE_USER] || []; - var groupShares = ev.itemShares[OC.Share.SHARE_TYPE_GROUP] || []; - var recipients = _.union(userShares, groupShares); if (recipients.length) { $tr.attr('data-share-recipients', OCA.Sharing.Util.formatRecipients(recipients)); } -- cgit v1.2.3