diff options
author | Roeland Jago Douma <rullzer@owncloud.com> | 2016-02-11 08:17:52 +0100 |
---|---|---|
committer | Roeland Jago Douma <rullzer@owncloud.com> | 2016-02-11 11:03:11 +0100 |
commit | f5be48d81dc4cb2d9e7b1ef340deec2ded042982 (patch) | |
tree | c243174043879a5b1cf7f7101374a3b1c7917338 /core | |
parent | 06af9b817edb1fdf230f71c2fc77bc9c12031bc6 (diff) | |
download | nextcloud-server-f5be48d81dc4cb2d9e7b1ef340deec2ded042982.tar.gz nextcloud-server-f5be48d81dc4cb2d9e7b1ef340deec2ded042982.zip |
Calculate the share statuses in js from the OCS Response
Right now this is only done on page load. We should do it on each
directory traversal.
Diffstat (limited to 'core')
-rw-r--r-- | core/js/share.js | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/core/js/share.js b/core/js/share.js index 9baa34d9bb7..b2c1bd5de10 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -52,15 +52,21 @@ OC.Share = _.extend(OC.Share || {}, { loadIcons:function(itemType, fileList, callback) { // Load all share icons $.get( - OC.filePath('core', 'ajax', 'share.php'), + OC.linkToOCS('apps/files_sharing/api/v1', 2) + 'shares', { - fetch: 'getItemsSharedStatuses', - itemType: itemType + subfiles: 'true', + path: fileList.dirInfo.path, + format: 'json' }, function(result) { - if (result && result.status === 'success') { + if (result && result.ocs.meta.statuscode === 200) { OC.Share.statuses = {}; - $.each(result.data, function(item, data) { - OC.Share.statuses[item] = data; + $.each(result.ocs.data, function(it, share) { + if (!(share.item_source in OC.Share.statuses)) { + OC.Share.statuses[share.item_source] = {link: false}; + } + if (share.share_type === OC.Share.SHARE_TYPE_LINK) { + OC.Share.statuses[share.item_source] = {link: true}; + } }); if (_.isFunction(callback)) { callback(OC.Share.statuses); |