diff options
-rw-r--r-- | lib/Db/MessageMapper.php | 25 | ||||
-rw-r--r-- | tests/psalm-baseline.xml | 59 |
2 files changed, 9 insertions, 75 deletions
diff --git a/lib/Db/MessageMapper.php b/lib/Db/MessageMapper.php index 77ec05776..e83d08961 100644 --- a/lib/Db/MessageMapper.php +++ b/lib/Db/MessageMapper.php @@ -433,37 +433,26 @@ class MessageMapper extends QBMapper { public function findThread(Account $account, int $messageId): array { $qb = $this->db->getQueryBuilder(); $subQb1 = $this->db->getQueryBuilder(); - $subQb2 = $this->db->getQueryBuilder(); $mailboxIdsQuery = $subQb1 ->select('id') ->from('mail_mailboxes') ->where($qb->expr()->eq('account_id', $qb->createNamedParameter($account->getId(), IQueryBuilder::PARAM_INT))); - $threadRootIdsQuery = $subQb2 - ->select('thread_root_id') - ->from($this->getTableName()) - ->where( - $qb->expr()->eq('id', $qb->createNamedParameter($messageId, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT) - ); /** * Select the message with the given ID or any that has the same thread ID */ $selectMessages = $qb - ->select('*') - ->from($this->getTableName()) + ->select('m2.*') + ->from($this->getTableName(), 'm1') + ->leftJoin('m1', $this->getTableName(), 'm2', $qb->expr()->eq('m1.thread_root_id', 'm2.thread_root_id')) ->where( - $qb->expr()->in('mailbox_id', $qb->createFunction($mailboxIdsQuery->getSQL()), IQueryBuilder::PARAM_INT_ARRAY), - $qb->expr()->orX( - $qb->expr()->eq('id', $qb->createNamedParameter($messageId, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT), - $qb->expr()->andX( - $qb->expr()->isNotNull('thread_root_id'), - $qb->expr()->in('thread_root_id', $qb->createFunction($threadRootIdsQuery->getSQL()), IQueryBuilder::PARAM_INT_ARRAY) - ) - ) + $qb->expr()->in('m1.mailbox_id', $qb->createFunction($mailboxIdsQuery->getSQL()), IQueryBuilder::PARAM_INT_ARRAY), + $qb->expr()->in('m2.mailbox_id', $qb->createFunction($mailboxIdsQuery->getSQL()), IQueryBuilder::PARAM_INT_ARRAY), + $qb->expr()->eq('m1.id', $qb->createNamedParameter($messageId, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT), + $qb->expr()->isNotNull('m1.thread_root_id') ) ->orderBy('sent_at', 'desc'); - return $this->findRecipients($this->findEntities($selectMessages)); } diff --git a/tests/psalm-baseline.xml b/tests/psalm-baseline.xml index 039c61c4b..097680584 100644 --- a/tests/psalm-baseline.xml +++ b/tests/psalm-baseline.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<files psalm-version="3.17.1@8f211792d813e4dc89f04ed372785ce93b902fd1"> +<files psalm-version="4.4.1@9fd7a7d885b3a216cff8dec9d8c21a132f275224"> <file src="lib/Attachment.php"> <MissingDocblockType occurrences="1"> <code>$fetch</code> @@ -30,49 +30,9 @@ </ImplicitToStringCast> </file> <file src="lib/Db/MessageMapper.php"> - <ImplicitToStringCast occurrences="44"> + <ImplicitToStringCast occurrences="23"> <code>$messagesQuery->createFunction($mailboxesQuery->getSQL())</code> <code>$qb->createFunction($mailboxIdsQuery->getSQL())</code> - <code>$qb->createFunction($selectMailboxIds->getSQL())</code> - <code>$qb->createFunction($threadRootIdsQuery->getSQL())</code> - <code>$qb->createNamedParameter($ids, IQueryBuilder::PARAM_INT_ARRAY)</code> - <code>$qb->createNamedParameter($ids, IQueryBuilder::PARAM_INT_ARRAY)</code> - <code>$qb->createNamedParameter($mailboxIds, IQueryBuilder::PARAM_INT_ARRAY)</code> - <code>$qb->createNamedParameter($query->getBcc(), IQueryBuilder::PARAM_STR_ARRAY)</code> - <code>$qb->createNamedParameter($query->getBcc(), IQueryBuilder::PARAM_STR_ARRAY)</code> - <code>$qb->createNamedParameter($query->getCc(), IQueryBuilder::PARAM_STR_ARRAY)</code> - <code>$qb->createNamedParameter($query->getCc(), IQueryBuilder::PARAM_STR_ARRAY)</code> - <code>$qb->createNamedParameter($query->getFrom(), IQueryBuilder::PARAM_STR_ARRAY)</code> - <code>$qb->createNamedParameter($query->getFrom(), IQueryBuilder::PARAM_STR_ARRAY)</code> - <code>$qb->createNamedParameter($query->getTo(), IQueryBuilder::PARAM_STR_ARRAY)</code> - <code>$qb->createNamedParameter($query->getTo(), IQueryBuilder::PARAM_STR_ARRAY)</code> - <code>$qb->createNamedParameter($uids, IQueryBuilder::PARAM_INT_ARRAY)</code> - <code>$qb->createNamedParameter($uids, IQueryBuilder::PARAM_INT_ARRAY)</code> - <code>$qb->createNamedParameter($uids, IQueryBuilder::PARAM_INT_ARRAY)</code> - <code>$qb1->createParameter('flag_answered')</code> - <code>$qb1->createParameter('flag_deleted')</code> - <code>$qb1->createParameter('flag_draft')</code> - <code>$qb1->createParameter('flag_flagged')</code> - <code>$qb1->createParameter('flag_forwarded')</code> - <code>$qb1->createParameter('flag_important')</code> - <code>$qb1->createParameter('flag_junk')</code> - <code>$qb1->createParameter('flag_notjunk')</code> - <code>$qb1->createParameter('flag_seen')</code> - <code>$qb1->createParameter('in_reply_to')</code> - <code>$qb1->createParameter('mailbox_id')</code> - <code>$qb1->createParameter('message_id')</code> - <code>$qb1->createParameter('references')</code> - <code>$qb1->createParameter('sent_at')</code> - <code>$qb1->createParameter('subject')</code> - <code>$qb1->createParameter('thread_root_id')</code> - <code>$qb1->createParameter('uid')</code> - <code>$qb2->createNamedParameter($ids, IQueryBuilder::PARAM_INT_ARRAY)</code> - <code>$qb2->createNamedParameter(array_keys($indexedMessages), IQueryBuilder::PARAM_INT_ARRAY)</code> - <code>$qb2->createParameter('email')</code> - <code>$qb2->createParameter('label')</code> - <code>$qb2->createParameter('message_id')</code> - <code>$qb2->createParameter('type')</code> - <code>$qb4->createNamedParameter($ids, IQueryBuilder::PARAM_INT_ARRAY)</code> <code>$query->createNamedParameter($ids, IQueryBuilder::PARAM_INT_ARRAY)</code> <code>$query->createNamedParameter($uids, IQueryBuilder::PARAM_INT_ARRAY)</code> </ImplicitToStringCast> @@ -88,16 +48,6 @@ <code>$qb->createNamedParameter($mailboxIds, IQueryBuilder::PARAM_INT_ARRAY)</code> </ImplicitToStringCast> </file> - <file src="lib/Listener/AccountSynchronizedThreadUpdaterListener.php"> - <MismatchingDocblockReturnType occurrences="1"> - <code>DatabaseMessage[]|Generator</code> - </MismatchingDocblockReturnType> - </file> - <file src="lib/Model/IMAPMessage.php"> - <LessSpecificImplementedReturnType occurrences="1"> - <code>array</code> - </LessSpecificImplementedReturnType> - </file> <file src="lib/Service/Classification/ImportanceClassifier.php"> <InvalidScalarArgument occurrences="1"> <code>$predictedValidationLabel</code> @@ -110,9 +60,4 @@ <code>null</code> </NullArgument> </file> - <file src="vendor/cerdic/css-tidy/class.csstidy.php"> - <InvalidDocblock occurrences="1"> - <code>public function parse_string_list($value) {</code> - </InvalidDocblock> - </file> </files> |