aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2016-10-26 13:17:35 +0200
committerGitHub <noreply@github.com>2016-10-26 13:17:35 +0200
commitffb0e91b60d437f8f3062d9cd18b76284342061b (patch)
treeec1d3bbdbf9448c91adf6db52ab2b531b6e424c2
parent995335b54da3ba0c1954ac0664e86e7239cb5847 (diff)
parent50b8221255c7fe88a1968419904ff295c4db9613 (diff)
downloadnextcloud-server-ffb0e91b60d437f8f3062d9cd18b76284342061b.tar.gz
nextcloud-server-ffb0e91b60d437f8f3062d9cd18b76284342061b.zip
Merge pull request #1907 from nextcloud/downstream-26164
Highlight files and update storage stats at end of upload (#26164)
-rw-r--r--apps/files/js/file-upload.js1
-rw-r--r--apps/files/js/filelist.js2
-rw-r--r--apps/files/tests/js/filelistSpec.js17
3 files changed, 15 insertions, 5 deletions
diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js
index 30784528700..8fec7d5c04e 100644
--- a/apps/files/js/file-upload.js
+++ b/apps/files/js/file-upload.js
@@ -1071,6 +1071,7 @@ OC.Uploader.prototype = _.extend({
self.clear();
self._hideProgressBar();
+ self.trigger('stop', e, data);
});
fileupload.on('fileuploadfail', function(e, data) {
self.log('progress handle fileuploadfail', e, data);
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index bf4fd75d4cc..18534db3ee9 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -2810,8 +2810,8 @@
$.when.apply($, promises).then(function() {
// highlight uploaded files
self.highlightFiles(fileNames);
+ self.updateStorageStatistics();
});
- self.updateStorageStatistics();
var uploadText = self.$fileList.find('tr .uploadtext');
self.showFileBusyState(uploadText.closest('tr'), false);
diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js
index 3b0e0b83b82..15dab3b9882 100644
--- a/apps/files/tests/js/filelistSpec.js
+++ b/apps/files/tests/js/filelistSpec.js
@@ -2794,13 +2794,22 @@ describe('OCA.Files.FileList tests', function() {
highlightStub.restore();
});
- it('queries storage stats', function() {
+ it('queries storage stats after all fetches are done', function() {
var statStub = sinon.stub(fileList, 'updateStorageStatistics');
- addFile(createUpload('upload.txt', '/subdir'));
- expect(statStub.notCalled).toEqual(true);
+ var highlightStub = sinon.stub(fileList, 'highlightFiles');
+ var def1 = addFile(createUpload('upload.txt', '/subdir'));
+ var def2 = addFile(createUpload('upload2.txt', '/subdir'));
+ var def3 = addFile(createUpload('upload3.txt', '/another'));
uploader.trigger('stop', {});
+
+ expect(statStub.notCalled).toEqual(true);
+ def1.resolve();
+ expect(statStub.notCalled).toEqual(true);
+ def2.resolve();
+ def3.resolve();
expect(statStub.calledOnce).toEqual(true);
- statStub.restore();
+
+ highlightStub.restore();
});
});
});