aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/dav/lib/SystemTag/SystemTagList.php12
1 files changed, 7 insertions, 5 deletions
diff --git a/apps/dav/lib/SystemTag/SystemTagList.php b/apps/dav/lib/SystemTag/SystemTagList.php
index 087c84fabd9..63e69db0eda 100644
--- a/apps/dav/lib/SystemTag/SystemTagList.php
+++ b/apps/dav/lib/SystemTag/SystemTagList.php
@@ -19,18 +19,20 @@ use Sabre\Xml\Writer;
*/
class SystemTagList implements Element {
public const NS_NEXTCLOUD = 'http://nextcloud.org/ns';
+ private array $canAssignTagMap = [];
/**
* @param ISystemTag[] $tags
*/
public function __construct(
private array $tags,
- private ISystemTagManager $tagManager,
- private ?IUser $user,
+ ISystemTagManager $tagManager,
+ ?IUser $user,
) {
$this->tags = $tags;
- $this->tagManager = $tagManager;
- $this->user = $user;
+ foreach ($this->tags as $tag) {
+ $this->canAssignTagMap[$tag->getId()] = $tagManager->canUserAssignTag($tag, $user);
+ }
}
/**
@@ -48,7 +50,7 @@ class SystemTagList implements Element {
foreach ($this->tags as $tag) {
$writer->startElement('{' . self::NS_NEXTCLOUD . '}system-tag');
$writer->writeAttributes([
- SystemTagPlugin::CANASSIGN_PROPERTYNAME => $this->tagManager->canUserAssignTag($tag, $this->user) ? 'true' : 'false',
+ SystemTagPlugin::CANASSIGN_PROPERTYNAME => $this->canAssignTagMap[$tag->getId()] ? 'true' : 'false',
SystemTagPlugin::ID_PROPERTYNAME => $tag->getId(),
SystemTagPlugin::USERASSIGNABLE_PROPERTYNAME => $tag->isUserAssignable() ? 'true' : 'false',
SystemTagPlugin::USERVISIBLE_PROPERTYNAME => $tag->isUserVisible() ? 'true' : 'false',