diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-06-04 10:37:04 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-06-04 10:37:04 +0200 |
commit | 07f1b263c99b67730fb054482eb241bfad280d57 (patch) | |
tree | 0200603731856e879a2ebe497e87ed18d7a6852d /apps/files_sharing/js | |
parent | 1297b2b883c447c5183a79eb6c0e0061b69aeadf (diff) | |
download | nextcloud-server-07f1b263c99b67730fb054482eb241bfad280d57.tar.gz nextcloud-server-07f1b263c99b67730fb054482eb241bfad280d57.zip |
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.
Diffstat (limited to 'apps/files_sharing/js')
-rw-r--r-- | apps/files_sharing/js/share.js | 10 |
1 files changed, 6 insertions, 4 deletions
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)); } |