prevent sharing from making aditional http requests while scanning

additional requests to the server can block feedback of scannning depending on server configuration
This commit is contained in:
Robin Appelman 2012-02-01 15:33:12 +01:00
parent a69d3c3346
commit 0124809a42
2 changed files with 4 additions and 0 deletions

View File

@ -2,6 +2,7 @@ $(document).ready(function() {
var shared_status = {}; var shared_status = {};
if (typeof FileActions !== 'undefined') { if (typeof FileActions !== 'undefined') {
FileActions.register('all', 'Share', function(filename) { FileActions.register('all', 'Share', function(filename) {
if (scanFiles.scanning){return;}//workaround to prevent aditional http request block scanning feedback
var icon; var icon;
var file = $('#dir').val()+'/'+filename; var file = $('#dir').val()+'/'+filename;
if(shared_status[file]) if(shared_status[file])

View File

@ -347,6 +347,7 @@ $(document).ready(function() {
function scanFiles(force){ function scanFiles(force){
force=!!force; //cast to bool force=!!force; //cast to bool
scanFiles.scanning=true;
$('#scanning-message').show(); $('#scanning-message').show();
$('#fileList').remove(); $('#fileList').remove();
var scannerEventSource=new OC.EventSource(OC.filePath('files','ajax','scan.php'),{force:force}); var scannerEventSource=new OC.EventSource(OC.filePath('files','ajax','scan.php'),{force:force});
@ -356,6 +357,7 @@ function scanFiles(force){
$('#scan-current').text(data.file+'/'); $('#scan-current').text(data.file+'/');
}); });
scannerEventSource.listen('success',function(success){ scannerEventSource.listen('success',function(success){
scanFiles.scanning=false;
if(success){ if(success){
window.location.reload(); window.location.reload();
}else{ }else{
@ -363,6 +365,7 @@ function scanFiles(force){
} }
}); });
} }
scanFiles.scanning=false;
function boolOperationFinished(data, callback) { function boolOperationFinished(data, callback) {
result = jQuery.parseJSON(data.responseText); result = jQuery.parseJSON(data.responseText);