From 6e546c746b59fb28ae3bdf666d0339f124e895d5 Mon Sep 17 00:00:00 2001 From: SebastianKrupinski Date: Tue, 17 Dec 2024 10:59:47 -0500 Subject: [PATCH] fixup! fix: add ability to send alternet text (html and plain) Signed-off-by: SebastianKrupinski --- lib/Controller/DraftsController.php | 34 ++++++++++------------------- lib/Controller/OutboxController.php | 17 +++++---------- 2 files changed, 18 insertions(+), 33 deletions(-) diff --git a/lib/Controller/DraftsController.php b/lib/Controller/DraftsController.php index 61f87123e3..a7351f8bde 100644 --- a/lib/Controller/DraftsController.php +++ b/lib/Controller/DraftsController.php @@ -76,8 +76,9 @@ public function __construct(string $appName, public function create( int $accountId, string $subject, - string $body, - string $editorBody, + ?string $bodyPlain, + ?string $bodyHtml, + ?string $editorBody, bool $isHtml, ?bool $smimeSign, ?bool $smimeEncrypt, @@ -101,15 +102,9 @@ public function create( $message->setAccountId($accountId); $message->setAliasId($aliasId); $message->setSubject($subject); - if ($isHtml) { - $message->setBodyPlain(null); - $message->setBodyHtml($body); - $message->setHtml(true); - } else { - $message->setBodyPlain($body); - $message->setBodyHtml(null); - $message->setHtml(false); - } + $message->setBodyPlain($bodyPlain); + $message->setBodyHtml($bodyHtml); + $message->setHtml($isHtml); $message->setEditorBody($editorBody); $message->setInReplyToMessageId($inReplyToMessageId); $message->setUpdatedAt($this->timeFactory->getTime()); @@ -153,8 +148,9 @@ public function create( public function update(int $id, int $accountId, string $subject, - string $body, - string $editorBody, + ?string $bodyPlain, + ?string $bodyHtml, + ?string $editorBody, bool $isHtml, ?bool $smimeSign, ?bool $smimeEncrypt, @@ -176,15 +172,9 @@ public function update(int $id, $message->setAccountId($accountId); $message->setAliasId($aliasId); $message->setSubject($subject); - if ($isHtml) { - $message->setBodyPlain(null); - $message->setBodyHtml($body); - $message->setHtml(true); - } else { - $message->setBodyPlain($body); - $message->setBodyHtml(null); - $message->setHtml(false); - } + $message->setBodyPlain($bodyPlain); + $message->setBodyHtml($bodyHtml); + $message->setHtml($isHtml); $message->setEditorBody($editorBody); $message->setFailed($failed); $message->setInReplyToMessageId($inReplyToMessageId); diff --git a/lib/Controller/OutboxController.php b/lib/Controller/OutboxController.php index d2982da5bc..382333dabc 100644 --- a/lib/Controller/OutboxController.php +++ b/lib/Controller/OutboxController.php @@ -90,8 +90,9 @@ public function show(int $id): JsonResponse { public function create( int $accountId, string $subject, - string $body, - string $editorBody, + ?string $bodyPlain, + ?string $bodyHtml, + ?string $editorBody, bool $isHtml, bool $smimeSign, bool $smimeEncrypt, @@ -118,15 +119,9 @@ public function create( $message->setAccountId($accountId); $message->setAliasId($aliasId); $message->setSubject($subject); - if ($isHtml) { - $message->setBodyPlain(null); - $message->setBodyHtml($body); - $message->setHtml(true); - } else { - $message->setBodyPlain($body); - $message->setBodyHtml(null); - $message->setHtml(false); - } + $message->setBodyPlain($bodyPlain); + $message->setBodyHtml($bodyHtml); + $message->setHtml($isHtml); $message->setEditorBody($editorBody); $message->setInReplyToMessageId($inReplyToMessageId); $message->setSendAt($sendAt);