diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/dav/lib/SystemTag/SystemTagsInUseCollection.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/apps/dav/lib/SystemTag/SystemTagsInUseCollection.php b/apps/dav/lib/SystemTag/SystemTagsInUseCollection.php index aa45e7d8f07..b57e685e7e7 100644 --- a/apps/dav/lib/SystemTag/SystemTagsInUseCollection.php +++ b/apps/dav/lib/SystemTag/SystemTagsInUseCollection.php @@ -27,6 +27,7 @@ declare(strict_types=1); namespace OCA\DAV\SystemTag; use OC\SystemTag\SystemTag; +use OC\SystemTag\SystemTagsInFilesDetector; use OC\User\NoUserException; use OCP\Files\IRootFolder; use OCP\Files\NotPermittedException; @@ -40,19 +41,22 @@ class SystemTagsInUseCollection extends SimpleCollection { protected IUserSession $userSession; protected IRootFolder $rootFolder; protected string $mediaType; - private ISystemTagManager $systemTagManager; + protected ISystemTagManager $systemTagManager; + protected SystemTagsInFilesDetector $systemTagsInFilesDetector; /** @noinspection PhpMissingParentConstructorInspection */ public function __construct( IUserSession $userSession, IRootFolder $rootFolder, ISystemTagManager $systemTagManager, + SystemTagsInFilesDetector $systemTagsInFilesDetector, string $mediaType = '' ) { $this->userSession = $userSession; $this->rootFolder = $rootFolder; $this->systemTagManager = $systemTagManager; $this->mediaType = $mediaType; + $this->systemTagsInFilesDetector = $systemTagsInFilesDetector; $this->name = 'systemtags-assigned'; if ($this->mediaType != '') { $this->name .= '/' . $this->mediaType; @@ -67,7 +71,7 @@ class SystemTagsInUseCollection extends SimpleCollection { if ($this->mediaType !== '') { throw new NotFound('Invalid media type'); } - return new self($this->userSession, $this->rootFolder, $this->systemTagManager, $name); + return new self($this->userSession, $this->rootFolder, $this->systemTagManager, $this->systemTagsInFilesDetector, $name); } /** @@ -89,7 +93,7 @@ class SystemTagsInUseCollection extends SimpleCollection { throw new Forbidden('Permission denied to read this collection'); } - $result = $userFolder->getSystemTags($this->mediaType); + $result = $this->systemTagsInFilesDetector->detectAssignedSystemTagsIn($userFolder, $this->mediaType); $children = []; foreach ($result as $tagData) { $tag = new SystemTag((string)$tagData['id'], $tagData['name'], (bool)$tagData['visibility'], (bool)$tagData['editable']); |