Skip to content

Commit

Permalink
Merge pull request #28843 from owncloud/stable10-files-reloadissue
Browse files Browse the repository at this point in the history
[stable10] Only reload file list when switching navigation sections
  • Loading branch information
Vincent Petry authored Aug 30, 2017
2 parents 17eef30 + 5c56881 commit 9513491
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 17 deletions.
3 changes: 2 additions & 1 deletion apps/files/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@
if (e && e.itemId) {
params = {
view: e.itemId,
dir: '/'
dir: '/',
force: true
};
this._changeUrl(params.view, params.dir);
OC.Apps.hideAppSidebar($('.detailsView'));
Expand Down
14 changes: 4 additions & 10 deletions apps/files/js/filelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@
this.$fileList.on('click','td.filename>a.name, td.filesize, td.date', _.bind(this._onClickFile, this));

this.$fileList.on('change', 'td.filename>.selectCheckBox', _.bind(this._onClickFileCheckbox, this));
this.$el.on('show', _.bind(this._onShow, this));
this.$el.on('urlChanged', _.bind(this._onUrlChanged, this));
this.$el.find('.select-all').click(_.bind(this._onClickSelectAll, this));
this.$el.find('.download').click(_.bind(this._onClickDownloadSelected, this));
Expand Down Expand Up @@ -548,22 +547,17 @@
this.$table.find('>thead').width($('#app-content').width() - OC.Util.getScrollBarWidth());
},

/**
* Event handler when leaving previously hidden state
*/
_onShow: function(e) {
this.reload();
},

/**
* Event handler for when the URL changed
*/
_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;
if (!e.force) {
if( (this._currentDirectory || this.$el.find('#dir').val()) && currentDir === e.dir) {
return;
}
}
this.changeDirectory(e.dir, false, true);
}
Expand Down
6 changes: 0 additions & 6 deletions apps/files/tests/js/filelistSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1501,12 +1501,6 @@ describe('OCA.Files.FileList tests', function() {
$('#app-content-files').trigger(new $.Event('urlChanged', {view: 'files', dir: '/somedir'}));
expect(fileList.getCurrentDirectory()).toEqual('/somedir');
});
it('reloads the list when leaving hidden state', function() {
var reloadStub = sinon.stub(fileList, 'reload');
$('#app-content-files').trigger(new $.Event('show'));
expect(reloadStub.calledOnce).toEqual(true);
reloadStub.restore();
});
it('refreshes breadcrumb after update', function() {
var setDirSpy = sinon.spy(fileList.breadcrumb, 'setDirectory');
fileList.changeDirectory('/anothersubdir');
Expand Down

0 comments on commit 9513491

Please sign in to comment.