fix(files): Fix controller setup for guests

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2023-02-28 15:34:11 +01:00
parent c440f00219
commit c02080fccb
No known key found for this signature in database
GPG Key ID: 74434EFE0D2E2205

View File

@ -42,24 +42,17 @@ class TagService {
private $userSession;
/** @var IManager */
private $activityManager;
/** @var ITags */
/** @var ITags|null */
private $tagger;
/** @var Folder */
private $homeFolder;
/** @var EventDispatcherInterface */
private $dispatcher;
/**
* @param IUserSession $userSession
* @param IManager $activityManager
* @param ITags $tagger
* @param Folder $homeFolder
* @param EventDispatcherInterface $dispatcher
*/
public function __construct(
IUserSession $userSession,
IManager $activityManager,
ITags $tagger,
?ITags $tagger,
Folder $homeFolder,
EventDispatcherInterface $dispatcher
) {
@ -81,6 +74,10 @@ class TagService {
* @throws \OCP\Files\NotFoundException if the file does not exist
*/
public function updateFileTags($path, $tags) {
if ($this->tagger === null) {
throw new \RuntimeException('No tagger set');
}
$fileId = $this->homeFolder->get($path)->getId();
$currentTags = $this->tagger->getTagsForObjects([$fileId]);