Merge pull request #3952 from nextcloud/bugfix/noid/attachment-folder-cron

Fetch attachment folder for the correct user during cron job
This commit is contained in:
Julius Härtl
2022-08-05 17:04:28 +02:00
committed by GitHub
2 changed files with 3 additions and 3 deletions

View File

@@ -203,11 +203,11 @@ class ConfigService {
return array_filter($groups); return array_filter($groups);
} }
public function getAttachmentFolder(): string { public function getAttachmentFolder(string $userId = null): string {
if ($this->getUserId() === null) { if ($this->getUserId() === null) {
throw new NoPermissionException('Must be logged in get the attachment folder'); throw new NoPermissionException('Must be logged in get the attachment folder');
} }
return $this->config->getUserValue($this->getUserId(), 'deck', 'attachment_folder', '/Deck'); return $this->config->getUserValue($userId ?? $this->getUserId(), 'deck', 'attachment_folder', '/Deck');
} }
} }

View File

@@ -101,7 +101,7 @@ class Listener {
} }
} }
$parent = $this->configService->getAttachmentFolder(); $parent = $this->configService->getAttachmentFolder($userId);
$event->setParent($parent); $event->setParent($parent);
if (!$event->getView()->is_dir($parent)) { if (!$event->getView()->is_dir($parent)) {
$event->getView()->mkdir($parent); $event->getView()->mkdir($parent);