summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/js/share.js
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2013-10-17 11:59:13 +0200
committerMorris Jobke <morris.jobke@gmail.com>2013-10-17 12:55:10 +0200
commit467f864db4de3b2d0341edc9788c31a7f723fb4d (patch)
tree5abbe5963677edc55393669de9dfeaa2ec9b80de /apps/files_sharing/js/share.js
parentea4f6e2431f8545a71022916ac530d994803e99c (diff)
downloadnextcloud-server-467f864db4de3b2d0341edc9788c31a7f723fb4d.tar.gz
nextcloud-server-467f864db4de3b2d0341edc9788c31a7f723fb4d.zip
Fixed sharing status update for new/uploaded files
Creating new files, folders or uploading files now have their sharing icon updated accordingly. For this, the global share status list that is cached in OC.Share.statuses is reused for new files. Performance should improve as the sharing list is now only loaded once per navigation session. In OC.Share, split loadIcons into loadIcons + updateIcons. Fixes #4977
Diffstat (limited to 'apps/files_sharing/js/share.js')
-rw-r--r--apps/files_sharing/js/share.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js
index 03ed02f41ef..68f6f3ba76f 100644
--- a/apps/files_sharing/js/share.js
+++ b/apps/files_sharing/js/share.js
@@ -1,11 +1,19 @@
$(document).ready(function() {
- var disableSharing = $('#disableSharing').data('status');
+ var disableSharing = $('#disableSharing').data('status'),
+ sharesLoaded = false;
if (typeof OC.Share !== 'undefined' && typeof FileActions !== 'undefined' && !disableSharing) {
-
$('#fileList').on('fileActionsReady',function(){
- OC.Share.loadIcons('file');
+ if (!sharesLoaded){
+ OC.Share.loadIcons('file');
+ // assume that we got all shares, so switching directories
+ // will not invalidate that list
+ sharesLoaded = true;
+ }
+ else{
+ OC.Share.updateIcons('file');
+ }
});
FileActions.register('all', 'Share', OC.PERMISSION_READ, OC.imagePath('core', 'actions/share'), function(filename) {