Skip to content

Commit

Permalink
Reset attachment folder when it cannot be created
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Jun 10, 2020
1 parent a0294ea commit 5cf3b95
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/TInitialState.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,6 @@ protected function publishInitialStateForUser(IUser $user, IRootFolder $rootFold
);

$attachmentFolder = $this->talkConfig->getAttachmentFolder($user->getUID());
$this->initialStateService->provideInitialState(
'talk', 'attachment_folder',
$attachmentFolder
);

if ($attachmentFolder) {
try {
Expand All @@ -96,9 +92,16 @@ protected function publishInitialStateForUser(IUser $user, IRootFolder $rootFold
$userFolder->newFolder($attachmentFolder);
}
} catch (NotPermittedException $e) {
$attachmentFolder = '/';
$this->serverConfig->setUserValue($user->getUID(), 'spreed', 'attachment_folder', '/');
} catch (NoUserException $e) {
}
}

$this->initialStateService->provideInitialState(
'talk', 'attachment_folder',
$attachmentFolder
);
}

protected function publishInitialStateForGuest(): void {
Expand Down

0 comments on commit 5cf3b95

Please sign in to comment.