feat: Add route to open messages via Message-ID#12632
feat: Add route to open messages via Message-ID#12632SoleroTG wants to merge 5 commits intonextcloud:mainfrom
Conversation
4366c3a to
a38f75a
Compare
| declare(strict_types=1); | ||
|
|
||
| /** | ||
| * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors |
There was a problem hiding this comment.
| * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors | |
| * SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors |
| MailAccountMapper $mailAccountMapper, | ||
| AccountService $accountService, | ||
| MessageMapper $messageMapper, | ||
| IURLGenerator $urlGenerator, | ||
| IUserSession $userSession, | ||
| LoggerInterface $logger |
There was a problem hiding this comment.
| MailAccountMapper $mailAccountMapper, | |
| AccountService $accountService, | |
| MessageMapper $messageMapper, | |
| IURLGenerator $urlGenerator, | |
| IUserSession $userSession, | |
| LoggerInterface $logger | |
| private MailAccountMapper $mailAccountMapper, | |
| private AccountService $accountService, | |
| private MessageMapper $messageMapper, | |
| private IURLGenerator $urlGenerator, | |
| private IUserSession $userSession, | |
| private LoggerInterface $logger |
There was a problem hiding this comment.
Adding private/protected/public in a class constructor = shortcut to create a property with the given name and assign the value to it.
| private MailAccountMapper $mailAccountMapper; | ||
| private AccountService $accountService; | ||
| private MessageMapper $messageMapper; | ||
| private IURLGenerator $urlGenerator; | ||
| private IUserSession $userSession; | ||
| private LoggerInterface $logger; |
There was a problem hiding this comment.
| private MailAccountMapper $mailAccountMapper; | |
| private AccountService $accountService; | |
| private MessageMapper $messageMapper; | |
| private IURLGenerator $urlGenerator; | |
| private IUserSession $userSession; | |
| private LoggerInterface $logger; |
There was a problem hiding this comment.
Still valid. Please use https://stitcher.io/blog/constructor-promotion-in-php-8
| $this->mailAccountMapper = $mailAccountMapper; | ||
| $this->accountService = $accountService; | ||
| $this->messageMapper = $messageMapper; | ||
| $this->urlGenerator = $urlGenerator; | ||
| $this->userSession = $userSession; | ||
| $this->logger = $logger; |
There was a problem hiding this comment.
| $this->mailAccountMapper = $mailAccountMapper; | |
| $this->accountService = $accountService; | |
| $this->messageMapper = $messageMapper; | |
| $this->urlGenerator = $urlGenerator; | |
| $this->userSession = $userSession; | |
| $this->logger = $logger; |
| /** | ||
| * @NoAdminRequired | ||
| * @NoCSRFRequired | ||
| * @PublicPage |
There was a problem hiding this comment.
| * @PublicPage |
|
|
||
| /** | ||
| * @NoAdminRequired | ||
| * @NoCSRFRequired |
There was a problem hiding this comment.
| * @NoCSRFRequired |
|
Thanks a lot for your pr, I will give it a test this week. |
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
|
Thanks again @SoleroTG for your pr. Please apply the suggested changes. The linter is failing, could you please format the code accordingly (composer run cs:fix). |
a38f75a to
016633b
Compare
Signed-off-by: SoleroTG <github-29h@solero.quietmail.eu>
Signed-off-by: SoleroTG <github-29h@solero.quietmail.eu>
Signed-off-by: SoleroTG <github-29h@solero.quietmail.eu>
This adds tests to verify the deep link routing behavior for message-id searches. It uses real instantiations of MailAccount and Message entities instead of mocks to properly test magic methods like getId() and getMailboxId() that cannot be configured on mocks. AI-assisted: Gemini CLI (Gemini 2.5 Pro) Signed-off-by: SoleroTG <github-29h@solero.quietmail.eu>
d3e675a to
4ce7b44
Compare
|
Thanks @kesselb for your feedback. I have applied the formatting, added the requested unit tests for the DeepLinkController and fixed the DCO issue. The PR is ready for another review! |
| private MailAccountMapper $mailAccountMapper; | ||
| private AccountService $accountService; | ||
| private MessageMapper $messageMapper; | ||
| private IURLGenerator $urlGenerator; | ||
| private IUserSession $userSession; | ||
| private LoggerInterface $logger; |
There was a problem hiding this comment.
Still valid. Please use https://stitcher.io/blog/constructor-promotion-in-php-8
| /** | ||
| * @NoAdminRequired | ||
| * @NoCSRFRequired | ||
| * @PublicPage |
| // Ensure formatting: Always wrapped in <> | ||
| $cleanedId = '<' . trim($messageId, '<>') . '>'; |
There was a problem hiding this comment.
Use Horde_Mail_Rfc822_Identification like we do at \OCA\Mail\Db\Message::parseMessageId.
There was a problem hiding this comment.
Thanks @ChristophWurst for your feedback.
I applied the changes. Please let me know If I forgot anything.
Signed-off-by: SoleroTG <github-29h@solero.quietmail.eu>
Related to #2269
Hi @ChristophWurst, this is the first part of the deep-linking feature.
What this PR does
This PR introduces a new frontend route
/apps/mail/open/<message-id>that allows opening a specific email directly if the Message-ID is known.The app will search for a message with the given ID across all accounts and mailboxes of the user and open it if found.
This is the foundational work for a future UI element that will allow users to copy such a link. The button for generating the link is not part of this PR and will follow in a separate one.
How to test
Message-IDof an existing email (e.g., from the email source).http://<your-nextcloud-instance>/index.php/apps/mail/open/<your-message-id>.<becomes%3C).