Merge pull request #29629 from nextcloud/backport/29611/stable21

[stable21] Show most recently deleted files first in trash can
pull/29851/head
MichaIng 2021-11-23 03:54:52 +07:00 committed by GitHub
commit fb701e344e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 5 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -48,7 +48,7 @@ class TrashManager implements ITrashManager {
return array_merge($items, $backend->listTrashRoot($user));
}, []);
usort($items, function (ITrashItem $a, ITrashItem $b) {
return $a->getDeletedTime() - $b->getDeletedTime();
return $b->getDeletedTime() - $a->getDeletedTime();
});
return $items;
}

@ -72,7 +72,7 @@
this.$el.find('.undelete').click('click', _.bind(this._onClickRestoreSelected, this))
// Sort by most recently deleted first
this.setSort('mtime', 'asc')
this.setSort('mtime', 'desc')
/**
* Override crumb making to add "Deleted Files" entry

@ -129,7 +129,7 @@ describe('OCA.Trashbin.FileList tests', function () {
describe('Initialization', function () {
it('Sorts by mtime by default', function () {
expect(fileList._sort).toEqual('mtime');
expect(fileList._sortDirection).toEqual('asc');
expect(fileList._sortDirection).toEqual('desc');
});
it('Always returns read and delete permission', function () {
expect(fileList.getDirectoryPermissions()).toEqual(OC.PERMISSION_READ | OC.PERMISSION_DELETE);