Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions apps/files/js/filelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
},
Expand Down
18 changes: 18 additions & 0 deletions apps/files/tests/js/filelistSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
});