From c287787f8df599b567f399f6022ffc88db3a0582 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Wed, 2 Oct 2019 11:47:00 +0200 Subject: Add a cache for IMAP message in the database Co-authored-by: Roeland Jago Douma Signed-off-by: Christoph Wurst Signed-off-by: Roeland Jago Douma --- lib/Controller/MessagesController.php | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/Controller/MessagesController.php') diff --git a/lib/Controller/MessagesController.php b/lib/Controller/MessagesController.php index 2764bbb3c..7e075621e 100755 --- a/lib/Controller/MessagesController.php +++ b/lib/Controller/MessagesController.php @@ -40,6 +40,7 @@ use OCA\Mail\Model\IMAPMessage; use OCA\Mail\Service\AccountService; use OCA\Mail\Service\IMailBox; use OCA\Mail\Service\ItineraryService; +use OCA\Mail\Service\SyncService; use OCP\AppFramework\Controller; use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Http; @@ -69,6 +70,9 @@ class MessagesController extends Controller { /** @var ItineraryService */ private $itineraryService; + /** @var SyncService */ + private $syncService; + /** @var string */ private $currentUserId; @@ -104,6 +108,7 @@ class MessagesController extends Controller { IMailManager $mailManager, IMailSearch $mailSearch, ItineraryService $itineraryService, + SyncService $syncService, string $UserId, $userFolder, ILogger $logger, @@ -116,6 +121,7 @@ class MessagesController extends Controller { $this->mailManager = $mailManager; $this->mailSearch = $mailSearch; $this->itineraryService = $itineraryService; + $this->syncService = $syncService; $this->currentUserId = $UserId; $this->userFolder = $userFolder; $this->logger = $logger; @@ -144,6 +150,11 @@ class MessagesController extends Controller { return new JSONResponse(null, Http::STATUS_FORBIDDEN); } + $this->syncService->ensurePopulated( + $account, + base64_decode($folderId) + ); + $this->logger->debug("loading messages of folder <$folderId>"); return new JSONResponse( -- cgit v1.2.3