]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix: sort tags by name
authorArthur Schiwon <blizzz@arthur-schiwon.de>
Thu, 4 May 2023 11:15:15 +0000 (13:15 +0200)
committerArthur Schiwon <blizzz@arthur-schiwon.de>
Thu, 4 May 2023 11:21:14 +0000 (13:21 +0200)
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
apps/dav/lib/SystemTag/SystemTagPlugin.php

index c5c828cfbff30618bad7da65cb12b9e9c42bc498..8f0c4d0eedc33941c38874842bc2f960f630208a 100644 (file)
@@ -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\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 +308,11 @@ class SystemTagPlugin extends \Sabre\DAV\ServerPlugin {
                        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);
                });
        }