Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable14] Fix opening a section again in the Files app #11995

Merged
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
6 changes: 0 additions & 6 deletions apps/files/js/favoritesfilelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,6 @@ $(document).ready(function() {

return OCA.Files.FileList.prototype.reloadCallback.call(this, status, result);
},

_onUrlChanged: function (e) {
if (e && _.isString(e.dir)) {
this.changeDirectory(e.dir, false, true);
}
}
});

OCA.Files.FavoritesFileList = FavoritesFileList;
Expand Down
5 changes: 5 additions & 0 deletions apps/files/js/favoritesplugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@
return new OCA.Files.FavoritesFileList(
$el, {
fileActions: fileActions,
// The file list is created when a "show" event is handled,
// so it should be marked as "shown" like it would have been
// done if handling the event with the file list already
// created.
shown: true
}
);
},
Expand Down
4 changes: 4 additions & 0 deletions apps/files/js/filelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@
return;
}

if (options.shown) {
this.shown = options.shown;
}

if (options.config) {
this._filesConfig = options.config;
} else if (!_.isUndefined(OCA.Files) && !_.isUndefined(OCA.Files.App)) {
Expand Down
5 changes: 5 additions & 0 deletions apps/files/js/recentplugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@
return new OCA.Files.RecentFileList(
$el, {
fileActions: fileActions,
// The file list is created when a "show" event is handled,
// so it should be marked as "shown" like it would have been
// done if handling the event with the file list already
// created.
shown: true
}
);
},
Expand Down
30 changes: 25 additions & 5 deletions apps/files_sharing/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ OCA.Sharing.App = {
id: 'shares.self',
sharedWithUser: true,
fileActions: this._createFileActions(),
config: OCA.Files.App.getFilesConfig()
config: OCA.Files.App.getFilesConfig(),
// The file list is created when a "show" event is handled, so
// it should be marked as "shown" like it would have been done
// if handling the event with the file list already created.
shown: true
}
);

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

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

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

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

Expand Down
6 changes: 0 additions & 6 deletions apps/files_sharing/js/sharedfilelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,12 +444,6 @@
// Sort by expected sort comparator
return files.sort(this._sortComparator);
},

_onUrlChanged: function(e) {
if (e && _.isString(e.dir)) {
this.changeDirectory(e.dir, false, true);
}
}
});

/**
Expand Down
26 changes: 15 additions & 11 deletions apps/files_trashbin/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,21 @@ OCA.Trashbin.App = {
scrollTo: urlParams.scrollto,
config: OCA.Files.App.getFilesConfig(),
multiSelectMenu: [
{
name: 'restore',
displayName: t('files', 'Restore'),
iconClass: 'icon-history',
},
{
name: 'delete',
displayName: t('files', 'Delete'),
iconClass: 'icon-delete',
}
]
{
name: 'restore',
displayName: t('files', 'Restore'),
iconClass: 'icon-history',
},
{
name: 'delete',
displayName: t('files', 'Delete'),
iconClass: 'icon-delete',
}
],
// The file list is created when a "show" event is handled, so
// it should be marked as "shown" like it would have been done
// if handling the event with the file list already created.
shown: true
}
);
},
Expand Down
7 changes: 6 additions & 1 deletion apps/systemtags/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@
{
id: 'systemtags',
fileActions: this._createFileActions(),
config: OCA.Files.App.getFilesConfig()
config: OCA.Files.App.getFilesConfig(),
// The file list is created when a "show" event is handled,
// so it should be marked as "shown" like it would have been
// done if handling the event with the file list already
// created.
shown: true
}
);

Expand Down
72 changes: 72 additions & 0 deletions tests/acceptance/features/app-files.feature
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,78 @@ Feature: app-files
When I open the details view for "welcome.txt"
Then I see that the details view is open

Scenario: show recent files
Given I am logged in
And I create a new folder named "Folder just created"
When I open the "Recent" section
Then I see that the current section is "Recent"
Then I see that the file list contains a file named "Folder just created"

Scenario: show recent files for a second time
Given I am logged in
And I open the "Recent" section
And I see that the current section is "Recent"
And I open the "All files" section
And I see that the current section is "All files"
And I create a new folder named "Folder just created"
When I open the "Recent" section
Then I see that the current section is "Recent"
Then I see that the file list contains a file named "Folder just created"

Scenario: show favorites
Given I am logged in
And I mark "welcome.txt" as favorite
When I open the "Favorites" section
Then I see that the current section is "Favorites"
Then I see that the file list contains a file named "welcome.txt"

Scenario: show favorites for a second time
Given I am logged in
And I open the "Favorites" section
And I see that the current section is "Favorites"
And I open the "All files" section
And I see that the current section is "All files"
And I mark "welcome.txt" as favorite
When I open the "Favorites" section
Then I see that the current section is "Favorites"
Then I see that the file list contains a file named "welcome.txt"

Scenario: show shares
Given I am logged in
And I share the link for "welcome.txt"
When I open the "Shares" section
Then I see that the current section is "Shares"
Then I see that the file list contains a file named "welcome.txt"

Scenario: show shares for a second time
Given I am logged in
And I open the "Shares" section
And I see that the current section is "Shares"
And I open the "All files" section
And I see that the current section is "All files"
And I share the link for "welcome.txt"
When I open the "Shares" section
Then I see that the current section is "Shares"
Then I see that the file list contains a file named "welcome.txt"

Scenario: show deleted files
Given I am logged in
And I delete "welcome.txt"
When I open the "Deleted files" section
Then I see that the current section is "Deleted files"
Then I see that the file list contains a file named "welcome.txt"

Scenario: show deleted files for a second time
Given I am logged in
And I open the "Deleted files" section
And I see that the current section is "Deleted files"
And I open the "All files" section
And I see that the current section is "All files"
And I delete "welcome.txt"
When I open the "Deleted files" section
Then I see that the current section is "Deleted files"
Then I see that the file list contains a file named "welcome.txt"

Scenario: rename a file with the details view open
Given I am logged in
And I open the details view for "welcome.txt"
Expand Down
16 changes: 16 additions & 0 deletions tests/acceptance/features/bootstrap/FileListContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,13 @@ public static function viewFileInFolderMenuItem() {
return self::fileActionsMenuItemFor("View in folder");
}

/**
* @return Locator
*/
public static function deleteMenuItem() {
return self::fileActionsMenuItemFor("Delete");
}

/**
* @Given I create a new folder named :folderName
*/
Expand Down Expand Up @@ -322,6 +329,15 @@ public function iViewInFolder($fileName) {
$this->actor->find(self::viewFileInFolderMenuItem(), 2)->click();
}

/**
* @When I delete :fileName
*/
public function iDelete($fileName) {
$this->actor->find(self::fileActionsMenuButtonForFile($this->fileListAncestor, $fileName), 10)->click();

$this->actor->find(self::deleteMenuItem(), 2)->click();
}

/**
* @Then I see that the file list is eventually loaded
*/
Expand Down