From badee49b4b3e8d67c3b264326da7be2d0187846e Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Thu, 4 May 2023 13:15:15 +0200 Subject: [PATCH 1/2] fix: sort tags by name Signed-off-by: Arthur Schiwon --- apps/dav/lib/SystemTag/SystemTagPlugin.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/dav/lib/SystemTag/SystemTagPlugin.php b/apps/dav/lib/SystemTag/SystemTagPlugin.php index c5c828cfbff30..8f0c4d0eedc33 100644 --- a/apps/dav/lib/SystemTag/SystemTagPlugin.php +++ b/apps/dav/lib/SystemTag/SystemTagPlugin.php @@ -25,6 +25,7 @@ */ namespace OCA\DAV\SystemTag; +use OC\SystemTag\SystemTag; use OCA\DAV\Connector\Sabre\Directory; use OCA\DAV\Connector\Sabre\Node; use OCP\IGroupManager; @@ -34,6 +35,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; @@ -306,8 +308,11 @@ private function propfindForFile(PropFind $propFind, Node $node): void { if ($user === null) { return; } - + $tags = $this->getTagsForFile($node->getId(), $user); + usort($tags, function (SystemTag $tagA, SystemTag $tagB): int { + return Util::naturalSortCompare($tagA->getName(), $tagB->getName()); + }); return new SystemTagList($tags, $this->tagManager, $user); }); } From e20e18f45f5bb06cc82e34169317079bf99f5b58 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Wed, 10 May 2023 19:06:29 +0200 Subject: [PATCH 2/2] fix: use interface instead of implementation as type hint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com> Signed-off-by: Arthur Schiwon --- apps/dav/lib/SystemTag/SystemTagPlugin.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/dav/lib/SystemTag/SystemTagPlugin.php b/apps/dav/lib/SystemTag/SystemTagPlugin.php index 8f0c4d0eedc33..3c834bf71eb13 100644 --- a/apps/dav/lib/SystemTag/SystemTagPlugin.php +++ b/apps/dav/lib/SystemTag/SystemTagPlugin.php @@ -25,7 +25,6 @@ */ namespace OCA\DAV\SystemTag; -use OC\SystemTag\SystemTag; use OCA\DAV\Connector\Sabre\Directory; use OCA\DAV\Connector\Sabre\Node; use OCP\IGroupManager; @@ -310,7 +309,7 @@ private function propfindForFile(PropFind $propFind, Node $node): void { } $tags = $this->getTagsForFile($node->getId(), $user); - usort($tags, function (SystemTag $tagA, SystemTag $tagB): int { + usort($tags, function (ISystemTag $tagA, ISystemTag $tagB): int { return Util::naturalSortCompare($tagA->getName(), $tagB->getName()); }); return new SystemTagList($tags, $this->tagManager, $user);