summaryrefslogtreecommitdiffstats
path: root/core/js/share.js
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2015-08-11 22:34:08 +0200
committerVincent Petry <pvince81@owncloud.com>2015-09-16 07:23:25 +0200
commite6edc3e05dfc17584c81d11c52b444ffcf965c62 (patch)
treec8984b95750c8ec9d29faf883f5a285a81de3e8e /core/js/share.js
parent7971bc1ac0a52ed5171a3a663b6e18dcda93bbc3 (diff)
downloadnextcloud-server-e6edc3e05dfc17584c81d11c52b444ffcf965c62.tar.gz
nextcloud-server-e6edc3e05dfc17584c81d11c52b444ffcf965c62.zip
make loadItems work async if a callback is provided
not beautiful, but good enough. share.js will not be around too much longer.
Diffstat (limited to 'core/js/share.js')
-rw-r--r--core/js/share.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/core/js/share.js b/core/js/share.js
index 59467427eb3..d84da322274 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -293,23 +293,28 @@ OC.Share = _.extend(OC.Share, {
*
* @param itemType
* @param itemSource
+ * @param callback
* @returns {OC.Share.Types.ShareInfo}
*/
- loadItem:function(itemType, itemSource) {
+ loadItem:function(itemType, itemSource, callback) {
var data = '';
var checkReshare = true;
+ var async = !_.isUndefined(callback);
if (typeof OC.Share.statuses[itemSource] === 'undefined') {
// NOTE: Check does not always work and misses some shares, fix later
var checkShares = true;
} else {
var checkShares = true;
}
- $.ajax({type: 'GET', url: OC.filePath('core', 'ajax', 'share.php'), data: { fetch: 'getItem', itemType: itemType, itemSource: itemSource, checkReshare: checkReshare, checkShares: checkShares }, async: false, success: function(result) {
+ $.ajax({type: 'GET', url: OC.filePath('core', 'ajax', 'share.php'), data: { fetch: 'getItem', itemType: itemType, itemSource: itemSource, checkReshare: checkReshare, checkShares: checkShares }, async: async, success: function(result) {
if (result && result.status === 'success') {
data = result.data;
} else {
data = false;
}
+ if(async) {
+ callback(data);
+ }
}});
return data;