Merge pull request #38067 from nextcloud/fix/noid/sortTags

fix: sort tags by name
pull/38147/head
Arthur Schiwon 2023-05-11 09:54:15 +07:00 committed by GitHub
commit 2d41f0c064
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

@ -34,6 +34,7 @@ use OCP\SystemTag\ISystemTag;
use OCP\SystemTag\ISystemTagManager;
use OCP\SystemTag\ISystemTagObjectMapper;
use OCP\SystemTag\TagAlreadyExistsException;
use OCP\Util;
use Sabre\DAV\Exception\BadRequest;
use Sabre\DAV\Exception\Conflict;
use Sabre\DAV\Exception\Forbidden;
@ -306,8 +307,11 @@ class SystemTagPlugin extends \Sabre\DAV\ServerPlugin {
if ($user === null) {
return;
}
$tags = $this->getTagsForFile($node->getId(), $user);
usort($tags, function (ISystemTag $tagA, ISystemTag $tagB): int {
return Util::naturalSortCompare($tagA->getName(), $tagB->getName());
});
return new SystemTagList($tags, $this->tagManager, $user);
});
}