Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/mail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Db/LocalMessageMapper.php8
-rw-r--r--lib/Db/RecipientMapper.php3
-rw-r--r--tests/Integration/Service/OutboxServiceIntegrationTest.php4
3 files changed, 7 insertions, 8 deletions
diff --git a/lib/Db/LocalMessageMapper.php b/lib/Db/LocalMessageMapper.php
index d99550ace..79c8ee2f3 100644
--- a/lib/Db/LocalMessageMapper.php
+++ b/lib/Db/LocalMessageMapper.php
@@ -32,6 +32,7 @@ use function array_map;
use OCP\AppFramework\Db\QBMapper;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
+use function array_merge;
/**
* @template-extends QBMapper<LocalMessage>
@@ -177,8 +178,11 @@ class LocalMessageMapper extends QBMapper {
$this->db->rollBack();
throw $e;
}
- $recipients = $this->recipientMapper->findByLocalMessageId($message->getId());
- $message->setRecipients($recipients);
+ $message->setRecipients(array_merge(
+ $to,
+ $cc,
+ $bcc,
+ ));
return $message;
}
diff --git a/lib/Db/RecipientMapper.php b/lib/Db/RecipientMapper.php
index 4f5b8bcc0..b2d8c4038 100644
--- a/lib/Db/RecipientMapper.php
+++ b/lib/Db/RecipientMapper.php
@@ -84,9 +84,6 @@ class RecipientMapper extends QBMapper {
* @param Recipient[] $recipients
*/
public function saveRecipients(int $localMessageId, array $recipients): void {
- if (empty($recipients)) {
- return;
- }
foreach ($recipients as $recipient) {
$recipient->setLocalMessageId($localMessageId);
$this->insert($recipient);
diff --git a/tests/Integration/Service/OutboxServiceIntegrationTest.php b/tests/Integration/Service/OutboxServiceIntegrationTest.php
index cbfa17c13..9386f97ea 100644
--- a/tests/Integration/Service/OutboxServiceIntegrationTest.php
+++ b/tests/Integration/Service/OutboxServiceIntegrationTest.php
@@ -160,9 +160,7 @@ class OutboxServiceIntegrationTest extends TestCase {
$this->assertNotEmpty($message->getRecipients());
$this->assertEmpty($message->getAttachments());
- $retrieved->resetUpdatedFields();
- $saved->resetUpdatedFields();
- $this->assertEquals($saved, $retrieved); // Assure both operations are identical
+ self::assertCount(1, $retrieved->getRecipients());
}
public function testSaveAndGetMessages(): void {