Skip to content

Commit 3e8a38f

Browse files
authored
Merge pull request #11995 from nextcloud/stable14-11967-fix-opening-a-section-again-in-the-files-app
[stable14] Fix opening a section again in the Files app
2 parents 52c3285 + c1e37bb commit 3e8a38f

File tree

10 files changed

+148
-29
lines changed

10 files changed

+148
-29
lines changed

apps/files/js/favoritesfilelist.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,6 @@ $(document).ready(function() {
9494

9595
return OCA.Files.FileList.prototype.reloadCallback.call(this, status, result);
9696
},
97-
98-
_onUrlChanged: function (e) {
99-
if (e && _.isString(e.dir)) {
100-
this.changeDirectory(e.dir, false, true);
101-
}
102-
}
10397
});
10498

10599
OCA.Files.FavoritesFileList = FavoritesFileList;

apps/files/js/favoritesplugin.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@
6767
return new OCA.Files.FavoritesFileList(
6868
$el, {
6969
fileActions: fileActions,
70+
// The file list is created when a "show" event is handled,
71+
// so it should be marked as "shown" like it would have been
72+
// done if handling the event with the file list already
73+
// created.
74+
shown: true
7075
}
7176
);
7277
},

apps/files/js/filelist.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,10 @@
226226
return;
227227
}
228228

229+
if (options.shown) {
230+
this.shown = options.shown;
231+
}
232+
229233
if (options.config) {
230234
this._filesConfig = options.config;
231235
} else if (!_.isUndefined(OCA.Files) && !_.isUndefined(OCA.Files.App)) {

apps/files/js/recentplugin.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@
6767
return new OCA.Files.RecentFileList(
6868
$el, {
6969
fileActions: fileActions,
70+
// The file list is created when a "show" event is handled,
71+
// so it should be marked as "shown" like it would have been
72+
// done if handling the event with the file list already
73+
// created.
74+
shown: true
7075
}
7176
);
7277
},

apps/files_sharing/js/app.js

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ OCA.Sharing.App = {
3434
id: 'shares.self',
3535
sharedWithUser: true,
3636
fileActions: this._createFileActions(),
37-
config: OCA.Files.App.getFilesConfig()
37+
config: OCA.Files.App.getFilesConfig(),
38+
// The file list is created when a "show" event is handled, so
39+
// it should be marked as "shown" like it would have been done
40+
// if handling the event with the file list already created.
41+
shown: true
3842
}
3943
);
4044

@@ -56,7 +60,11 @@ OCA.Sharing.App = {
5660
id: 'shares.others',
5761
sharedWithUser: false,
5862
fileActions: this._createFileActions(),
59-
config: OCA.Files.App.getFilesConfig()
63+
config: OCA.Files.App.getFilesConfig(),
64+
// The file list is created when a "show" event is handled, so
65+
// it should be marked as "shown" like it would have been done
66+
// if handling the event with the file list already created.
67+
shown: true
6068
}
6169
);
6270

@@ -78,7 +86,11 @@ OCA.Sharing.App = {
7886
id: 'shares.link',
7987
linksOnly: true,
8088
fileActions: this._createFileActions(),
81-
config: OCA.Files.App.getFilesConfig()
89+
config: OCA.Files.App.getFilesConfig(),
90+
// The file list is created when a "show" event is handled, so
91+
// it should be marked as "shown" like it would have been done
92+
// if handling the event with the file list already created.
93+
shown: true
8294
}
8395
);
8496

@@ -101,7 +113,11 @@ OCA.Sharing.App = {
101113
showDeleted: true,
102114
sharedWithUser: true,
103115
fileActions: this._restoreShareAction(),
104-
config: OCA.Files.App.getFilesConfig()
116+
config: OCA.Files.App.getFilesConfig(),
117+
// The file list is created when a "show" event is handled, so
118+
// it should be marked as "shown" like it would have been done
119+
// if handling the event with the file list already created.
120+
shown: true
105121
}
106122
);
107123

@@ -122,7 +138,11 @@ OCA.Sharing.App = {
122138
{
123139
id: 'shares.overview',
124140
config: OCA.Files.App.getFilesConfig(),
125-
isOverview: true
141+
isOverview: true,
142+
// The file list is created when a "show" event is handled, so
143+
// it should be marked as "shown" like it would have been done
144+
// if handling the event with the file list already created.
145+
shown: true
126146
}
127147
);
128148

apps/files_sharing/js/sharedfilelist.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -444,12 +444,6 @@
444444
// Sort by expected sort comparator
445445
return files.sort(this._sortComparator);
446446
},
447-
448-
_onUrlChanged: function(e) {
449-
if (e && _.isString(e.dir)) {
450-
this.changeDirectory(e.dir, false, true);
451-
}
452-
}
453447
});
454448

455449
/**

apps/files_trashbin/js/app.js

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,21 @@ OCA.Trashbin.App = {
3131
scrollTo: urlParams.scrollto,
3232
config: OCA.Files.App.getFilesConfig(),
3333
multiSelectMenu: [
34-
{
35-
name: 'restore',
36-
displayName: t('files', 'Restore'),
37-
iconClass: 'icon-history',
38-
},
39-
{
40-
name: 'delete',
41-
displayName: t('files', 'Delete'),
42-
iconClass: 'icon-delete',
43-
}
44-
]
34+
{
35+
name: 'restore',
36+
displayName: t('files', 'Restore'),
37+
iconClass: 'icon-history',
38+
},
39+
{
40+
name: 'delete',
41+
displayName: t('files', 'Delete'),
42+
iconClass: 'icon-delete',
43+
}
44+
],
45+
// The file list is created when a "show" event is handled, so
46+
// it should be marked as "shown" like it would have been done
47+
// if handling the event with the file list already created.
48+
shown: true
4549
}
4650
);
4751
},

apps/systemtags/js/app.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@
2828
{
2929
id: 'systemtags',
3030
fileActions: this._createFileActions(),
31-
config: OCA.Files.App.getFilesConfig()
31+
config: OCA.Files.App.getFilesConfig(),
32+
// The file list is created when a "show" event is handled,
33+
// so it should be marked as "shown" like it would have been
34+
// done if handling the event with the file list already
35+
// created.
36+
shown: true
3237
}
3338
);
3439

tests/acceptance/features/app-files.feature

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,78 @@ Feature: app-files
3131
When I open the details view for "welcome.txt"
3232
Then I see that the details view is open
3333

34+
Scenario: show recent files
35+
Given I am logged in
36+
And I create a new folder named "Folder just created"
37+
When I open the "Recent" section
38+
Then I see that the current section is "Recent"
39+
Then I see that the file list contains a file named "Folder just created"
40+
41+
Scenario: show recent files for a second time
42+
Given I am logged in
43+
And I open the "Recent" section
44+
And I see that the current section is "Recent"
45+
And I open the "All files" section
46+
And I see that the current section is "All files"
47+
And I create a new folder named "Folder just created"
48+
When I open the "Recent" section
49+
Then I see that the current section is "Recent"
50+
Then I see that the file list contains a file named "Folder just created"
51+
52+
Scenario: show favorites
53+
Given I am logged in
54+
And I mark "welcome.txt" as favorite
55+
When I open the "Favorites" section
56+
Then I see that the current section is "Favorites"
57+
Then I see that the file list contains a file named "welcome.txt"
58+
59+
Scenario: show favorites for a second time
60+
Given I am logged in
61+
And I open the "Favorites" section
62+
And I see that the current section is "Favorites"
63+
And I open the "All files" section
64+
And I see that the current section is "All files"
65+
And I mark "welcome.txt" as favorite
66+
When I open the "Favorites" section
67+
Then I see that the current section is "Favorites"
68+
Then I see that the file list contains a file named "welcome.txt"
69+
70+
Scenario: show shares
71+
Given I am logged in
72+
And I share the link for "welcome.txt"
73+
When I open the "Shares" section
74+
Then I see that the current section is "Shares"
75+
Then I see that the file list contains a file named "welcome.txt"
76+
77+
Scenario: show shares for a second time
78+
Given I am logged in
79+
And I open the "Shares" section
80+
And I see that the current section is "Shares"
81+
And I open the "All files" section
82+
And I see that the current section is "All files"
83+
And I share the link for "welcome.txt"
84+
When I open the "Shares" section
85+
Then I see that the current section is "Shares"
86+
Then I see that the file list contains a file named "welcome.txt"
87+
88+
Scenario: show deleted files
89+
Given I am logged in
90+
And I delete "welcome.txt"
91+
When I open the "Deleted files" section
92+
Then I see that the current section is "Deleted files"
93+
Then I see that the file list contains a file named "welcome.txt"
94+
95+
Scenario: show deleted files for a second time
96+
Given I am logged in
97+
And I open the "Deleted files" section
98+
And I see that the current section is "Deleted files"
99+
And I open the "All files" section
100+
And I see that the current section is "All files"
101+
And I delete "welcome.txt"
102+
When I open the "Deleted files" section
103+
Then I see that the current section is "Deleted files"
104+
Then I see that the file list contains a file named "welcome.txt"
105+
34106
Scenario: rename a file with the details view open
35107
Given I am logged in
36108
And I open the details view for "welcome.txt"

tests/acceptance/features/bootstrap/FileListContext.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,13 @@ public static function viewFileInFolderMenuItem() {
254254
return self::fileActionsMenuItemFor("View in folder");
255255
}
256256

257+
/**
258+
* @return Locator
259+
*/
260+
public static function deleteMenuItem() {
261+
return self::fileActionsMenuItemFor("Delete");
262+
}
263+
257264
/**
258265
* @Given I create a new folder named :folderName
259266
*/
@@ -322,6 +329,15 @@ public function iViewInFolder($fileName) {
322329
$this->actor->find(self::viewFileInFolderMenuItem(), 2)->click();
323330
}
324331

332+
/**
333+
* @When I delete :fileName
334+
*/
335+
public function iDelete($fileName) {
336+
$this->actor->find(self::fileActionsMenuButtonForFile($this->fileListAncestor, $fileName), 10)->click();
337+
338+
$this->actor->find(self::deleteMenuItem(), 2)->click();
339+
}
340+
325341
/**
326342
* @Then I see that the file list is eventually loaded
327343
*/

0 commit comments

Comments
 (0)