]> source.dussan.org Git - nextcloud-server.git/commitdiff
calling getstoragestats.php only if a user is logged in because this call requires...
authorThomas Müller <thomas.mueller@tmit.eu>
Tue, 5 Nov 2013 11:18:25 +0000 (12:18 +0100)
committerThomas Müller <thomas.mueller@tmit.eu>
Tue, 5 Nov 2013 11:18:25 +0000 (12:18 +0100)
apps/files/js/files.js

index 5fa2b128153d330b0185b66037e923e9bf124507..eb30ddfda0f7e03ff19763a560f19bf71befc21b 100644 (file)
@@ -357,24 +357,26 @@ $(document).ready(function() {
                        Files.updateMaxUploadFilesize(response);
                });
        }
-
-       // start on load - we ask the server every 5 minutes
-       var update_storage_statistics_interval = 5*60*1000;
-       var update_storage_statistics_interval_id = setInterval(update_storage_statistics, update_storage_statistics_interval);
-
-       // Use jquery-visibility to de-/re-activate file stats sync
-       if ($.support.pageVisibility) {
-               $(document).on({
-                       'show.visibility': function() {
-                               if (!update_storage_statistics_interval_id) {
-                                       update_storage_statistics_interval_id = setInterval(update_storage_statistics, update_storage_statistics_interval);
+       // only possible at the moment if user is logged in
+       if (OC.currentUser) {
+               // start on load - we ask the server every 5 minutes
+               var update_storage_statistics_interval = 5*60*1000;
+               var update_storage_statistics_interval_id = setInterval(update_storage_statistics, update_storage_statistics_interval);
+
+               // Use jquery-visibility to de-/re-activate file stats sync
+               if ($.support.pageVisibility) {
+                       $(document).on({
+                               'show.visibility': function() {
+                                       if (!update_storage_statistics_interval_id) {
+                                               update_storage_statistics_interval_id = setInterval(update_storage_statistics, update_storage_statistics_interval);
+                                       }
+                               },
+                               'hide.visibility': function() {
+                                       clearInterval(update_storage_statistics_interval_id);
+                                       update_storage_statistics_interval_id = 0;
                                }
-                       },
-                       'hide.visibility': function() {
-                               clearInterval(update_storage_statistics_interval_id);
-                               update_storage_statistics_interval_id = 0;
-                       }
-               });
+                       });
+               }
        }
 
        //scroll to and highlight preselected file