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);