Skip to content

Commit f5954a2

Browse files
authored
Merge pull request #29611 from newroco/bugfix/16412/show-most-recently-deleted-files-first
Show most recently deleted files first in trash can
2 parents 70c10f0 + 00c23cc commit f5954a2

5 files changed

Lines changed: 5 additions & 5 deletions

File tree

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
@@ -47,7 +47,7 @@ public function listTrashRoot(IUser $user): array {
4747
return array_merge($items, $backend->listTrashRoot($user));
4848
}, []);
4949
usort($items, function (ITrashItem $a, ITrashItem $b) {
50-
return $a->getDeletedTime() - $b->getDeletedTime();
50+
return $b->getDeletedTime() - $a->getDeletedTime();
5151
});
5252
return $items;
5353
}

apps/files_trashbin/src/filelist.js

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

9292
// Sort by most recently deleted first
93-
this.setSort('mtime', 'asc')
93+
this.setSort('mtime', 'desc')
9494

9595
/**
9696
* 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
@@ -136,7 +136,7 @@ describe('OCA.Trashbin.FileList tests', function () {
136136
describe('Initialization', function () {
137137
it('Sorts by mtime by default', function () {
138138
expect(fileList._sort).toEqual('mtime');
139-
expect(fileList._sortDirection).toEqual('asc');
139+
expect(fileList._sortDirection).toEqual('desc');
140140
});
141141
it('Always returns read and delete permission', function () {
142142
expect(fileList.getDirectoryPermissions()).toEqual(OC.PERMISSION_READ | OC.PERMISSION_DELETE);

0 commit comments

Comments
 (0)