diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2019-01-24 13:35:05 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2019-01-24 13:35:05 +0300 |
commit | 1731270aae02a3426cd9c38fff32e801ebcdcaed (patch) | |
tree | 649756138420a4e52bc67d5372d30c5fde848e2b /lib | |
parent | 08f8c77fcb80ea1a332ec7319389d6e396f1c4e1 (diff) | |
parent | f454a64e0eac663e66f69a6827666617bb006bf8 (diff) |
Merge branch 'master' of github.com:/nextcloud/mail into fix/pagecontroller-string-userid-typehint
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Controller/PageController.php | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 7b192f5a4..c74ce8c57 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -26,10 +26,12 @@ declare(strict_types=1); namespace OCA\Mail\Controller; +use Exception; use OCA\Mail\Contracts\IUserPreferences; use OCA\Mail\Http\JSONResponse; use OCA\Mail\Service\AccountService; use OCA\Mail\Service\AliasesService; +use OCA\Mail\Service\MailManager; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\ContentSecurityPolicy; use OCP\AppFramework\Http\RedirectResponse; @@ -62,6 +64,9 @@ class PageController extends Controller { /** @var IUserPreferences */ private $preferences; + /** @var MailManager */ + private $mailManager; + /** * @param string $appName * @param IRequest $request @@ -75,7 +80,7 @@ class PageController extends Controller { public function __construct(string $appName, IRequest $request, IURLGenerator $urlGenerator, IConfig $config, AccountService $accountService, AliasesService $aliasesService, $UserId, IUserSession $userSession, - IUserPreferences $preferences) { + IUserPreferences $preferences, MailManager $mailManager) { parent::__construct($appName, $request); $this->urlGenerator = $urlGenerator; @@ -85,6 +90,7 @@ class PageController extends Controller { $this->currentUserId = $UserId; $this->userSession = $userSession; $this->preferences = $preferences; + $this->mailManager = $mailManager; } /** @@ -101,6 +107,13 @@ class PageController extends Controller { $json = $mailAccount->jsonSerialize(); $json['aliases'] = $this->aliasesService->findAll($mailAccount->getId(), $this->currentUserId); + try { + $folders = $this->mailManager->getFolders($mailAccount); + $json['folders'] = $folders; + } catch (Exception $ex) { + $json['folders'] = []; + $json['error'] = true; + } $accountsJson[] = $json; } |