summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2023-05-05 21:28:09 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2023-05-09 23:51:52 +0200
commitdbfd2f936aaae95aabd52ac8de03b48a813bbb8f (patch)
treee7275f004576e0bd3e69bf3b5b88aadea472bb69 /apps
parent7f3725c96217fb6ada2ceeedcefa552aa216b9e0 (diff)
downloadnextcloud-server-dbfd2f936aaae95aabd52ac8de03b48a813bbb8f.tar.gz
nextcloud-server-dbfd2f936aaae95aabd52ac8de03b48a813bbb8f.zip
refactor: remove SystemTag logic from Folder into QuerySearchHelper
- adds OC\SystemTag\SystemTagsInFilesDetector where the search logic is moved to Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/lib/SystemTag/SystemTagsInUseCollection.php10
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']);