Skip to content

Commit

Permalink
Fix outbox API from/to/cc/bcc properties
Browse files Browse the repository at this point in the history
They are expected as four properties but were normalized into one array.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
  • Loading branch information
ChristophWurst committed Apr 7, 2022
1 parent 323d9b2 commit 59f044c
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 59f044c

Please sign in to comment.