Skip to content

Commit

Permalink
Merge pull request #36904 from nextcloud/bugfix/noid/fix-controller-s…
Browse files Browse the repository at this point in the history
…etup-for-guests

fix(files): Fix controller setup for guests
  • Loading branch information
nickvergessen authored Mar 6, 2023
2 parents eddc6f2 + c02080f commit 394ad98
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions apps/files/lib/Service/TagService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
) {
Expand All @@ -81,6 +74,10 @@ public function __construct(
* @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]);
Expand Down

0 comments on commit 394ad98

Please sign in to comment.