Skip to content

Commit

Permalink
fixup! fix: add ability to send alternet text (html and plain)
Browse files Browse the repository at this point in the history
Signed-off-by: SebastianKrupinski <[email protected]>
  • Loading branch information
SebastianKrupinski committed Dec 17, 2024
1 parent f8ff009 commit 6e546c7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 33 deletions.
34 changes: 12 additions & 22 deletions lib/Controller/DraftsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);

Check failure on line 108 in lib/Controller/DraftsController.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-master

PossiblyNullArgument

lib/Controller/DraftsController.php:108:27: PossiblyNullArgument: Argument 1 of setEditorBody cannot be null, possibly null value provided (see https://psalm.dev/078)
$message->setInReplyToMessageId($inReplyToMessageId);
$message->setUpdatedAt($this->timeFactory->getTime());
Expand Down Expand Up @@ -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,
Expand All @@ -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);

Check failure on line 178 in lib/Controller/DraftsController.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-master

PossiblyNullArgument

lib/Controller/DraftsController.php:178:27: PossiblyNullArgument: Argument 1 of setEditorBody cannot be null, possibly null value provided (see https://psalm.dev/078)
$message->setFailed($failed);
$message->setInReplyToMessageId($inReplyToMessageId);
Expand Down
17 changes: 6 additions & 11 deletions lib/Controller/OutboxController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
Expand Down

0 comments on commit 6e546c7

Please sign in to comment.