From bcdbc4e19e9b92c2e5ae32454558ebfbfb806159 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Thu, 2 Aug 2018 14:14:17 +0200 Subject: [PATCH 1/3] Fix return value of change directory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- apps/files/js/filelist.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index f44a36435a..373aa38951 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -1623,7 +1623,7 @@ // discard finished uploads list, we'll get it through a regular reload this._uploads = {}; - this.reload().then(function(success){ + return this.reload().then(function(success){ if (!success) { self.changeDirectory(currentDir, true); } From 16f6c071735577453ab8c4fb24451de28828195e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Fri, 3 Aug 2018 11:47:53 +0200 Subject: [PATCH 2/3] Always call render to replace the app-sidebar if the detail view is updated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- apps/files/js/detailsview.js | 7 +++++-- apps/files/js/filelist.js | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/files/js/detailsview.js b/apps/files/js/detailsview.js index ac10b8380e..aed1736693 100644 --- a/apps/files/js/detailsview.js +++ b/apps/files/js/detailsview.js @@ -118,10 +118,13 @@ */ render: function() { // remove old instances - if ($('#app-sidebar').length === 0) { + var $appSidebar = $('#app-sidebar'); + if ($appSidebar.length === 0) { this.$el.insertAfter($('#app-content')); } else { - $('#app-sidebar').replaceWith(this.$el) + if ($appSidebar[0] !== this.el) { + $appSidebar.replaceWith(this.$el) + } } var templateVars = { diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 373aa38951..8e7c60551a 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -564,7 +564,7 @@ } this._currentFileModel = model; - + this._detailsView.render(); this._detailsView.setFileInfo(model); this._detailsView.$el.scrollTop(0); }, From 1b4d502bfdd3234a698533d482c8c80e1305aa82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Fri, 3 Aug 2018 13:36:40 +0200 Subject: [PATCH 3/3] Adjust acceptance test to check if the correct sidebar view is shown MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- tests/acceptance/features/app-files.feature | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/acceptance/features/app-files.feature b/tests/acceptance/features/app-files.feature index 956430c02b..00f09900d3 100644 --- a/tests/acceptance/features/app-files.feature +++ b/tests/acceptance/features/app-files.feature @@ -1,15 +1,23 @@ Feature: app-files - Scenario: viewing a favorite file in its folder closes the details view + Scenario: viewing a favorite file in its folder shows the correct sidebar view Given I am logged in + And I create a new folder named "other" + And I mark "other" as favorite And I mark "welcome.txt" as favorite + And I see that "other" is marked as favorite And I see that "welcome.txt" is marked as favorite And I open the "Favorites" section - And I open the details view for "welcome.txt" + And I open the details view for "other" And I see that the details view is open + And I see that the file name shown in the details view is "other" When I view "welcome.txt" in folder Then I see that the current section is "All files" - And I see that the details view is closed + And I see that the details view is open + And I see that the file name shown in the details view is "welcome.txt" + When I open the details view for "other" + And I see that the file name shown in the details view is "other" + Scenario: viewing a favorite file in its folder does not prevent opening the details view in "All files" section Given I am logged in