diff options
author | kondou <kondou@ts.unde.re> | 2014-03-01 02:46:27 +0100 |
---|---|---|
committer | kondou <kondou@ts.unde.re> | 2014-06-02 21:09:41 +0200 |
commit | 9bc3f3cf304c300c758743f2e460beb1fee3ecac (patch) | |
tree | ea564110fcd3a28caee27af3bf36486d1783cc3e /core/js/share.js | |
parent | c88c0b9a13231478c626296d78aac7c1f66d87d9 (diff) | |
download | nextcloud-server-9bc3f3cf304c300c758743f2e460beb1fee3ecac.tar.gz nextcloud-server-9bc3f3cf304c300c758743f2e460beb1fee3ecac.zip |
Scrutinizer cleanup
Diffstat (limited to 'core/js/share.js')
-rw-r--r-- | core/js/share.js | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/core/js/share.js b/core/js/share.js index 0c6d39e446c..bcc04225b9f 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -7,24 +7,31 @@ OC.Share={ statuses:{}, droppedDown:false, /** - * Loads ALL share statuses from server, stores them in OC.Share.statuses then - * calls OC.Share.updateIcons() to update the files "Share" icon to "Shared" - * according to their share status and share type. + * Loads ALL share statuses from server, stores them in + * OC.Share.statuses then calls OC.Share.updateIcons() to update the + * files "Share" icon to "Shared" according to their share status and + * share type. * * @param itemType item type * @param fileList file list instance, defaults to OCA.Files.App.fileList */ loadIcons:function(itemType, fileList) { // Load all share icons - $.get(OC.filePath('core', 'ajax', 'share.php'), { fetch: 'getItemsSharedStatuses', itemType: itemType }, function(result) { - if (result && result.status === 'success') { - OC.Share.statuses = {}; - $.each(result.data, function(item, data) { - OC.Share.statuses[item] = data; - }); - OC.Share.updateIcons(itemType, fileList); + $.get( + OC.filePath('core', 'ajax', 'share.php'), + { + fetch: 'getItemsSharedStatuses', + itemType: itemType + }, function(result) { + if (result && result.status === 'success') { + OC.Share.statuses = {}; + $.each(result.data, function(item, data) { + OC.Share.statuses[item] = data; + }); + OC.Share.updateIcons(itemType, fileList); + } } - }); + ); }, /** * Updates the files' "Share" icons according to the known @@ -202,19 +209,20 @@ OC.Share={ itemSourceName: itemSourceName, expirationDate: expirationDate }, function (result) { - if (result && result.status === 'success') { - if (callback) { - callback(result.data); - } - } else { - if (result.data && result.data.message) { - var msg = result.data.message; + if (result && result.status === 'success') { + if (callback) { + callback(result.data); + } } else { - var msg = t('core', 'Error'); + if (result.data && result.data.message) { + var msg = result.data.message; + } else { + var msg = t('core', 'Error'); + } + OC.dialogs.alert(msg, t('core', 'Error while sharing')); } - OC.dialogs.alert(msg, t('core', 'Error while sharing')); } - }); + ); }, unshare:function(itemType, itemSource, shareType, shareWith, callback) { $.post(OC.filePath('core', 'ajax', 'share.php'), { action: 'unshare', itemType: itemType, itemSource: itemSource, shareType: shareType, shareWith: shareWith }, function(result) { |