From 3066cdf054d7a7c463b8fe21a52b2e286579ba12 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Thu, 7 Apr 2022 21:35:31 +0200 Subject: [PATCH] Fix outbox API from/to/cc/bcc properties They are expected as four properties but were normalized into one array. Signed-off-by: Christoph Wurst --- lib/Db/LocalMessage.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/Db/LocalMessage.php b/lib/Db/LocalMessage.php index 52580618ed..dd310aaabd 100644 --- a/lib/Db/LocalMessage.php +++ b/lib/Db/LocalMessage.php @@ -27,6 +27,7 @@ use JsonSerializable; use OCP\AppFramework\Db\Entity; +use function array_filter; /** * @method int getType() @@ -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; + }), ]; }