Skip to content

Commit

Permalink
fix(files): Fix controller setup for guests
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen authored and backportbot-nextcloud[bot] committed Mar 6, 2023
1 parent b21ef48 commit dff9d30
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 dff9d30

Please sign in to comment.