Skip to content

Commit

Permalink
Merge pull request #38067 from nextcloud/fix/noid/sortTags
Browse files Browse the repository at this point in the history
fix: sort tags by name
  • Loading branch information
blizzz authored May 11, 2023
2 parents db02684 + e20e18f commit 2d41f0c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apps/dav/lib/SystemTag/SystemTagPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
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;
Expand Down Expand Up @@ -306,8 +307,11 @@ private function propfindForFile(PropFind $propFind, Node $node): void {
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);
});
}
Expand Down

0 comments on commit 2d41f0c

Please sign in to comment.