summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2017-03-03 11:55:53 +0100
committerGitHub <noreply@github.com>2017-03-03 11:55:53 +0100
commit29e9b1f3d5318e279533be3e80a2db6e35ecb049 (patch)
treed46089159e338a5b4eb9df5856366b28a49f9bd8
parente648b8cb6d04bec8637b176e47663f7fb849f8b7 (diff)
parent93f9db4d59ec7795fe998d45ae8b49f3581231c0 (diff)
downloadnextcloud-server-29e9b1f3d5318e279533be3e80a2db6e35ecb049.tar.gz
nextcloud-server-29e9b1f3d5318e279533be3e80a2db6e35ecb049.zip
Merge pull request #3686 from nextcloud/downstream-27282
filelist only refreshed if directory changes
-rw-r--r--apps/files/js/filelist.js5
-rw-r--r--apps/files/tests/js/filelistSpec.js18
2 files changed, 23 insertions, 0 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 3a59da53517..1f4b8f0ec68 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -557,6 +557,11 @@
*/
_onUrlChanged: function(e) {
if (e && _.isString(e.dir)) {
+ var currentDir = this.getCurrentDirectory();
+ // this._currentDirectory is NULL when fileList is first initialised
+ if( (this._currentDirectory || this.$el.find('#dir').val()) && currentDir === e.dir) {
+ return;
+ }
this.changeDirectory(e.dir, false, true);
}
},
diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js
index c5a75be7c62..f3c04c48cb3 100644
--- a/apps/files/tests/js/filelistSpec.js
+++ b/apps/files/tests/js/filelistSpec.js
@@ -3005,4 +3005,22 @@ describe('OCA.Files.FileList tests', function() {
testMountType(123, 'external-root', 'external', 'external');
});
});
+ describe('file list should not refresh if url does not change', function() {
+ var fileListStub;
+
+ beforeEach(function() {
+ fileListStub = sinon.stub(OCA.Files.FileList.prototype, 'changeDirectory');
+ });
+ afterEach(function() {
+ fileListStub.restore();
+ });
+ it('File list must not be refreshed', function() {
+ $('#app-content-files').trigger(new $.Event('urlChanged', {dir: '/subdir'}));
+ expect(fileListStub.notCalled).toEqual(true);
+ });
+ it('File list must be refreshed', function() {
+ $('#app-content-files').trigger(new $.Event('urlChanged', {dir: '/'}));
+ expect(fileListStub.notCalled).toEqual(false);
+ });
+ });
});