chibenwa commented on a change in pull request #365:
URL: https://github.com/apache/james-project/pull/365#discussion_r607499301
##########
File path:
server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MDNParseMethod.scala
##########
@@ -82,27 +83,30 @@ class MDNParseMethod @Inject()(val blobResolvers:
BlobResolvers,
val invalid: Seq[MDNParseResults] =
validations.map(_.left).flatMap(_.toOption)
val parsed: SFlux[MDNParseResults] = SFlux.fromIterable(parsedIds)
- .flatMap(blobId => toParseResults(blobId, mailboxSession,
mdnEmailIdResolver))
+ .flatMap(blobId => toParseResults(blobId, mailboxSession))
SFlux.merge(Seq(parsed, SFlux.fromIterable(invalid)))
.reduce(MDNParseResults.empty())(MDNParseResults.merge)
.map(_.asResponse(request.accountId))
}
- private def toParseResults(blobId: BlobId, mailboxSession: MailboxSession,
mdnEmailIdResolver: MDNEmailIdResolver): SMono[MDNParseResults] =
+ private def toParseResults(blobId: BlobId, mailboxSession: MailboxSession):
SMono[MDNParseResults] =
blobResolvers.resolve(blobId, mailboxSession)
.flatMap(blob => parse(blob.blobId, blob.content)
- .flatMap(mdnAndMsg => {
-
mdnEmailIdResolver.resolveForEmailId(mdnAndMsg._1.getReport.getOriginalMessageIdField.toScala,
mdnAndMsg._1.getReport.getFinalRecipientField)
- .map(messageId => MDNParsed.fromMDN(mdnAndMsg._1, mdnAndMsg._2,
messageId))
- .map(mdnParsed => MDNParseResults.parse(blobId, mdnParsed))
- }))
+ .flatMap(mdnAndMsg => buildMDNParser(blobId, mdnAndMsg._1,
mdnAndMsg._2)))
.onErrorResume {
case e: BlobNotFoundException =>
SMono.just(MDNParseResults.notFound(e.blobId))
case e: BlobUnParsableException =>
SMono.just(MDNParseResults.notParse(e.blobId))
case _ => SMono.just(MDNParseResults.notParse(blobId))
}
+ private def buildMDNParser(blobId: BlobId, mdn: MDN, message: Message):
SMono[MDNParseResults] = {
+ val session =
mailboxManager.createSystemSession(Username.of(mdn.getReport.getFinalRecipientField.getFinalRecipient.formatted()))
Review comment:
We are searching in the mailbox of the guy owning the MDN (so the MDN
receiver).
The original email will be in his `Sent` mailbox.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]