From 07c5c686a02d765670394b3f2b14894105a29845 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Julius=20H=C3=A4rtl?= Date: Tue, 20 Nov 2018 14:44:20 +0100 Subject: [PATCH] Do not switch to root folder if filelist is already shown MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Navigating to the root folder is already handled by OCA.Files.Navigation.setActiveItem in case the view doesn't change. Signed-off-by: Julius Härtl --- apps/files/js/filelist.js | 9 +++++++-- apps/files/js/navigation.js | 7 ++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index a7dadbbab3e..7d4dc76daf0 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -593,8 +593,13 @@ */ _onShow: function(e) { if (this.shown) { - this._setCurrentDir('/', false); - this.reload(); + if (e.itemId === this.id) { + this._setCurrentDir('/', false); + } + // Only reload if we don't navigate to a different directory + if (typeof e.dir === 'undefined' || e.dir === this.getCurrentDirectory()) { + this.reload(); + } } this.shown = true; }, diff --git a/apps/files/js/navigation.js b/apps/files/js/navigation.js index 9fc2180c923..db48775f0fb 100644 --- a/apps/files/js/navigation.js +++ b/apps/files/js/navigation.js @@ -119,7 +119,12 @@ this.$currentContent = $('#app-content-' + (typeof itemView === 'string' && itemView !== '' ? itemView : itemId)); this.$currentContent.removeClass('hidden'); if (!options || !options.silent) { - this.$currentContent.trigger(jQuery.Event('show')); + this.$currentContent.trigger(jQuery.Event('show', { + itemId: itemId, + previousItemId: oldItemId, + dir: itemDir, + view: itemView + })); this.$el.trigger( new $.Event('itemChanged', { itemId: itemId, -- 2.39.5