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:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-02-20 18:12:11 +0300
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-02-24 09:12:16 +0300
commit46916ee4f396e71075fd228a87ef294e38825dea (patch)
treefbe43ebdd9862f3992ea60da7af40ea1c627a05e /lib/Controller/MessagesController.php
parent5be88a693bf7e516b1159f3c0500302c0adbe514 (diff)
Make envelope lists more versatile
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/Controller/MessagesController.php')
-rwxr-xr-xlib/Controller/MessagesController.php40
1 files changed, 35 insertions, 5 deletions
diff --git a/lib/Controller/MessagesController.php b/lib/Controller/MessagesController.php
index 9a6fc82de..8726c5be7 100755
--- a/lib/Controller/MessagesController.php
+++ b/lib/Controller/MessagesController.php
@@ -54,6 +54,7 @@ use OCP\IL10N;
use OCP\ILogger;
use OCP\IRequest;
use OCP\IURLGenerator;
+use function array_map;
use function base64_decode;
class MessagesController extends Controller {
@@ -176,23 +177,52 @@ class MessagesController extends Controller {
return new JSONResponse(null, Http::STATUS_FORBIDDEN);
}
+ $this->logger->debug("loading message of folder <$folderId>");
+
+ return new JSONResponse(
+ $this->mailSearch->findMessage(
+ $account,
+ base64_decode($folderId),
+ $id
+ )
+ );
+ }
+
+ /**
+ * @NoAdminRequired
+ * @TrapError
+ *
+ * @param int $accountId
+ * @param string $folderId
+ * @param int $messageId
+ *
+ * @return JSONResponse
+ * @throws ServiceException
+ */
+ public function getBody(int $accountId, string $folderId, int $messageId): JSONResponse {
+ try {
+ $account = $this->accountService->find($this->currentUserId, $accountId);
+ } catch (DoesNotExistException $e) {
+ return new JSONResponse(null, Http::STATUS_FORBIDDEN);
+ }
+
$json = $this->mailManager->getMessage(
$account,
base64_decode($folderId),
- $id,
+ $messageId,
true
)->getFullMessage(
$accountId,
base64_decode($folderId),
- $id
+ $messageId
);
$json['itineraries'] = $this->itineraryService->extract(
$account,
base64_decode($folderId),
- $id
+ $messageId
);
- $json['attachments'] = array_map(function ($a) use ($accountId, $folderId, $id) {
- return $this->enrichDownloadUrl($accountId, $folderId, $id, $a);
+ $json['attachments'] = array_map(function ($a) use ($accountId, $folderId, $messageId) {
+ return $this->enrichDownloadUrl($accountId, $folderId, $messageId, $a);
}, $json['attachments']);
return new JSONResponse($json);