Skip to content

Commit

Permalink
Merge pull request #6207 from nextcloud/fix/outbox-api-from-to-cc-bcc
Browse files Browse the repository at this point in the history
Fix outbox API from/to/cc/bcc properties
  • Loading branch information
miaulalala authored Apr 7, 2022
2 parents 94db15f + 3066cdf commit 45bb14c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/Db/LocalMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

use JsonSerializable;
use OCP\AppFramework\Db\Entity;
use function array_filter;

/**
* @method int getType()
Expand Down Expand Up @@ -106,7 +107,18 @@ public function jsonSerialize() {
'html' => $this->isHtml(),
'inReplyToMessageId' => $this->getInReplyToMessageId(),
'attachments' => $this->getAttachments(),
'recipients' => $this->getRecipients()
'from' => array_filter($this->getRecipients(), function (Recipient $recipient) {
return $recipient->getType() === Recipient::TYPE_FROM;
}),
'to' => array_filter($this->getRecipients(), function (Recipient $recipient) {
return $recipient->getType() === Recipient::TYPE_TO;
}),
'cc' => array_filter($this->getRecipients(), function (Recipient $recipient) {
return $recipient->getType() === Recipient::TYPE_CC;
}),
'bcc' => array_filter($this->getRecipients(), function (Recipient $recipient) {
return $recipient->getType() === Recipient::TYPE_BCC;
}),
];
}

Expand Down

0 comments on commit 45bb14c

Please sign in to comment.