Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/mail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2019-08-30 11:01:57 +0300
committerRoeland Jago Douma <roeland@famdouma.nl>2019-10-17 02:17:04 +0300
commit5f744699ca36aefa919668cb717ae15c045be89a (patch)
tree7a9864212574d12dfce761b267fad2abd3c125f5 /lib/Controller
parenta2adb6aad7d798b192738ca0fa757f8aa3f406c4 (diff)
Lets use the server methods for caching
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/Controller')
-rw-r--r--lib/Controller/AccountsController.php3
-rw-r--r--lib/Controller/AliasesController.php2
-rw-r--r--lib/Controller/AutoCompleteController.php2
-rw-r--r--lib/Controller/AvatarsController.php16
-rw-r--r--lib/Controller/FoldersController.php2
-rw-r--r--lib/Controller/LocalAttachmentsController.php2
-rwxr-xr-xlib/Controller/MessagesController.php12
-rw-r--r--lib/Controller/PageController.php1
-rw-r--r--lib/Controller/PreferencesController.php2
9 files changed, 14 insertions, 28 deletions
diff --git a/lib/Controller/AccountsController.php b/lib/Controller/AccountsController.php
index 61fee9a7f..0198a34ba 100644
--- a/lib/Controller/AccountsController.php
+++ b/lib/Controller/AccountsController.php
@@ -30,11 +30,9 @@ declare(strict_types=1);
namespace OCA\Mail\Controller;
use Exception;
-use Horde_Exception;
use OCA\Mail\Contracts\IMailTransmission;
use OCA\Mail\Exception\ClientException;
use OCA\Mail\Exception\ServiceException;
-use OCA\Mail\Http\JSONResponse;
use OCA\Mail\Model\NewMessageData;
use OCA\Mail\Model\RepliedMessageData;
use OCA\Mail\Service\AccountService;
@@ -43,6 +41,7 @@ use OCA\Mail\Service\GroupsIntegration;
use OCA\Mail\Service\SetupService;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
+use OCP\AppFramework\Http\JSONResponse;
use OCP\IL10N;
use OCP\ILogger;
use OCP\IRequest;
diff --git a/lib/Controller/AliasesController.php b/lib/Controller/AliasesController.php
index 1d16f19de..cda86bd65 100644
--- a/lib/Controller/AliasesController.php
+++ b/lib/Controller/AliasesController.php
@@ -24,10 +24,10 @@ declare(strict_types=1);
namespace OCA\Mail\Controller;
use OCA\Mail\Exception\NotImplemented;
-use OCA\Mail\Http\JSONResponse;
use OCA\Mail\Service\AliasesService;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
+use OCP\AppFramework\Http\JSONResponse;
use OCP\IRequest;
use OCP\IUser;
use OCP\IUserSession;
diff --git a/lib/Controller/AutoCompleteController.php b/lib/Controller/AutoCompleteController.php
index a97340241..b714c5e1d 100644
--- a/lib/Controller/AutoCompleteController.php
+++ b/lib/Controller/AutoCompleteController.php
@@ -23,9 +23,9 @@ declare(strict_types=1);
namespace OCA\Mail\Controller;
-use OCA\Mail\Http\JSONResponse;
use OCA\Mail\Service\AutoCompletion\AutoCompleteService;
use OCP\AppFramework\Controller;
+use OCP\AppFramework\Http\JSONResponse;
use OCP\IRequest;
class AutoCompleteController extends Controller {
diff --git a/lib/Controller/AvatarsController.php b/lib/Controller/AvatarsController.php
index d7202dfda..7d5d26b7e 100644
--- a/lib/Controller/AvatarsController.php
+++ b/lib/Controller/AvatarsController.php
@@ -26,11 +26,10 @@ namespace OCA\Mail\Controller;
use OCA\Mail\Contracts\IAvatarService;
use OCA\Mail\Http\AvatarDownloadResponse;
-use OCA\Mail\Http\JSONResponse;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
+use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Http\Response;
-use OCP\AppFramework\Utility\ITimeFactory;
use OCP\IRequest;
class AvatarsController extends Controller {
@@ -41,19 +40,14 @@ class AvatarsController extends Controller {
/** @var string */
private $uid;
- /** @var ITimeFactory */
- private $timeFactory;
-
public function __construct(string $appName,
IRequest $request,
IAvatarService $avatarService,
- string $UserId,
- ITimeFactory $timeFactory) {
+ string $UserId) {
parent::__construct($appName, $request);
$this->avatarService = $avatarService;
$this->uid = $UserId;
- $this->timeFactory = $timeFactory;
}
/**
@@ -80,7 +74,7 @@ class AvatarsController extends Controller {
// Debounce this a bit
// (cache for one day)
- $response->setCacheHeaders(24 * 60 * 60, $this->timeFactory);
+ $response->cacheFor(24*60*60);
return $response;
}
@@ -88,7 +82,7 @@ class AvatarsController extends Controller {
$response = new JSONResponse($avatar);
// Let the browser cache this for a week
- $response->setCacheHeaders(7 * 24 * 60 * 60, $this->timeFactory);
+ $response->cacheFor(7 * 24 * 60 * 60);
return $response;
}
@@ -118,7 +112,7 @@ class AvatarsController extends Controller {
$resp->addHeader('Content-Type', $avatar->getMime());
// Let the browser cache this for a week
- $resp->setCacheHeaders(7 * 24 * 60 * 60, $this->timeFactory);
+ $resp->cacheFor(7 * 24 * 60 * 60);
return $resp;
}
diff --git a/lib/Controller/FoldersController.php b/lib/Controller/FoldersController.php
index 6c5409df5..5316bfb1c 100644
--- a/lib/Controller/FoldersController.php
+++ b/lib/Controller/FoldersController.php
@@ -29,11 +29,11 @@ use function base64_decode;
use function is_array;
use OCA\Mail\Contracts\IMailManager;
use OCA\Mail\Exception\NotImplemented;
-use OCA\Mail\Http\JSONResponse;
use OCA\Mail\IMAP\Sync\Request as SyncRequest;
use OCA\Mail\Service\AccountService;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
+use OCP\AppFramework\Http\JSONResponse;
use OCP\IRequest;
class FoldersController extends Controller {
diff --git a/lib/Controller/LocalAttachmentsController.php b/lib/Controller/LocalAttachmentsController.php
index 5d6dfdd45..ce98814ba 100644
--- a/lib/Controller/LocalAttachmentsController.php
+++ b/lib/Controller/LocalAttachmentsController.php
@@ -26,10 +26,10 @@ namespace OCA\Mail\Controller;
use OCA\Mail\Contracts\IAttachmentService;
use OCA\Mail\Exception\ClientException;
-use OCA\Mail\Http\JSONResponse;
use OCA\Mail\Service\Attachment\UploadedFile;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
+use OCP\AppFramework\Http\JSONResponse;
use OCP\IRequest;
class LocalAttachmentsController extends Controller {
diff --git a/lib/Controller/MessagesController.php b/lib/Controller/MessagesController.php
index a6d1821d7..32a87956a 100755
--- a/lib/Controller/MessagesController.php
+++ b/lib/Controller/MessagesController.php
@@ -85,9 +85,6 @@ class MessagesController extends Controller {
/** @var IURLGenerator */
private $urlGenerator;
- /** @var ITimeFactory */
- private $timeFactory;
-
/**
* @param string $appName
* @param IRequest $request
@@ -98,7 +95,6 @@ class MessagesController extends Controller {
* @param IL10N $l10n
* @param IMimeTypeDetector $mimeTypeDetector
* @param IURLGenerator $urlGenerator
- * @param ITimeFactory $timeFactory
*/
public function __construct(string $appName,
IRequest $request,
@@ -110,8 +106,7 @@ class MessagesController extends Controller {
ILogger $logger,
IL10N $l10n,
IMimeTypeDetector $mimeTypeDetector,
- IURLGenerator $urlGenerator,
- ITimeFactory $timeFactory) {
+ IURLGenerator $urlGenerator) {
parent::__construct($appName, $request);
$this->accountService = $accountService;
@@ -123,7 +118,7 @@ class MessagesController extends Controller {
$this->l10n = $l10n;
$this->mimeTypeDetector = $mimeTypeDetector;
$this->urlGenerator = $urlGenerator;
- $this->timeFactory = $timeFactory;
+ $this->mailManager = $mailManager;
}
/**
@@ -257,8 +252,7 @@ class MessagesController extends Controller {
$htmlResponse->setContentSecurityPolicy($policy);
// Enable caching
- $htmlResponse->setCacheHeaders(60 * 60, $this->timeFactory);
- $htmlResponse->addHeader('Pragma', 'cache');
+ $htmlResponse->cacheFor(60 * 60);
return $htmlResponse;
} catch (Exception $ex) {
diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php
index c74ce8c57..6538dd50a 100644
--- a/lib/Controller/PageController.php
+++ b/lib/Controller/PageController.php
@@ -28,7 +28,6 @@ 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;
diff --git a/lib/Controller/PreferencesController.php b/lib/Controller/PreferencesController.php
index 1e00a118d..280f70422 100644
--- a/lib/Controller/PreferencesController.php
+++ b/lib/Controller/PreferencesController.php
@@ -28,8 +28,8 @@ namespace OCA\Mail\Controller;
use OCA\Mail\Contracts\IUserPreferences;
use OCA\Mail\Exception\ClientException;
-use OCA\Mail\Http\JSONResponse;
use OCP\AppFramework\Controller;
+use OCP\AppFramework\Http\JSONResponse;
use OCP\IRequest;
class PreferencesController extends Controller {