Skip to content

Commit fb701e3

Browse files
authored
Merge pull request #29629 from nextcloud/backport/29611/stable21
[stable21] Show most recently deleted files first in trash can
2 parents 0102cb9 + c176dc2 commit fb701e3

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

apps/files_trashbin/js/files_trashbin.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/files_trashbin/js/files_trashbin.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/files_trashbin/lib/Trash/TrashManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function listTrashRoot(IUser $user): array {
4848
return array_merge($items, $backend->listTrashRoot($user));
4949
}, []);
5050
usort($items, function (ITrashItem $a, ITrashItem $b) {
51-
return $a->getDeletedTime() - $b->getDeletedTime();
51+
return $b->getDeletedTime() - $a->getDeletedTime();
5252
});
5353
return $items;
5454
}

apps/files_trashbin/src/filelist.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
this.$el.find('.undelete').click('click', _.bind(this._onClickRestoreSelected, this))
7373

7474
// Sort by most recently deleted first
75-
this.setSort('mtime', 'asc')
75+
this.setSort('mtime', 'desc')
7676

7777
/**
7878
* Override crumb making to add "Deleted Files" entry

apps/files_trashbin/tests/js/filelistSpec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ describe('OCA.Trashbin.FileList tests', function () {
129129
describe('Initialization', function () {
130130
it('Sorts by mtime by default', function () {
131131
expect(fileList._sort).toEqual('mtime');
132-
expect(fileList._sortDirection).toEqual('asc');
132+
expect(fileList._sortDirection).toEqual('desc');
133133
});
134134
it('Always returns read and delete permission', function () {
135135
expect(fileList.getDirectoryPermissions()).toEqual(OC.PERMISSION_READ | OC.PERMISSION_DELETE);

0 commit comments

Comments
 (0)