Arsnael commented on code in PR #1561:
URL: https://github.com/apache/james-project/pull/1561#discussion_r1208980335


##########
server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailSubmissionSetMethodFutureReleaseContract.scala:
##########
@@ -268,7 +312,90 @@ trait EmailSubmissionSetMethodFutureReleaseContract {
          |    },
          |    "c1"]]
          |}""".stripMargin
+    val response = `given`(
+      baseRequestSpecBuilder(server)
+        .setAuth(authScheme(UserCredential(ANDRE, ANDRE_PASSWORD)))
+        .addHeader(ACCEPT.toString, ACCEPT_RFC8621_VERSION_HEADER)
+        .setBody(requestAndre)
+        .build, new ResponseSpecBuilder().build)
+      .post.prettyPeek()
+      .`then`
+      .statusCode(SC_OK)
+      .contentType(JSON)
+      .extract
+      .body
+      .asString
+
+    assertThatJson(response)
+      .inPath("methodResponses[0][1].ids")
+      .isArray
+      .isEmpty()
+  }
+
+  @Test
+  def emailSubmissionSetCreateShouldDeliverEmailWhenHoldForExpired(server: 
GuiceJamesServer): Unit = {
+    val message: Message = Message.Builder
+      .of
+      .setSubject("test")
+      .setSender(BOB.asString)
+      .setFrom(BOB.asString)
+      .setTo(ANDRE.asString)
+      .setBody("testmail", StandardCharsets.UTF_8)
+      .build
+
+    val bobDraftsPath = MailboxPath.forUser(BOB, DefaultMailboxes.DRAFTS)
+    server.getProbe(classOf[MailboxProbeImpl]).createMailbox(bobDraftsPath)
+    val messageId: MessageId = 
server.getProbe(classOf[MailboxProbeImpl]).appendMessage(BOB.asString(), 
bobDraftsPath, AppendCommand.builder()
+      .build(message))
+      .getMessageId
+    val andreInboxPath = MailboxPath.inbox(ANDRE)
+    val andreInboxId: MailboxId = 
server.getProbe(classOf[MailboxProbeImpl]).createMailbox(andreInboxPath)
+
+    val request =
+      s"""{
+         |     "using": ["urn:ietf:params:jmap:core", 
"urn:ietf:params:jmap:mail", "urn:ietf:params:jmap:submission"],
+         |     "methodCalls": [
+         |             ["EmailSubmission/set", {
+         |                     "accountId": "$ACCOUNT_ID",
+         |                     "create": {
+         |                             "k1490": {
+         |                                     "emailId": 
"${messageId.serialize}",
+         |                                     "envelope": {
+         |                                             "mailFrom": {
+         |                                                     "email": 
"${BOB.asString}",
+         |                                                     "parameters": {
+         |                                                       "holdFor": 
"76000"
+         |                                                     }
+         |                                             },
+         |                                             "rcptTo": [{
+         |                                                     "email": 
"${ANDRE.asString}"
+         |                                             }]
+         |                                     }
+         |                             }
+         |                     }
+         |             }, "c1"]
+         |     ]
+         |}""".stripMargin
+
+    `with`()
+      .header(ACCEPT.toString, ACCEPT_RFC8621_VERSION_HEADER)
+      .body(request)
+      .post.prettyPeek()

Review Comment:
   debug spotted



##########
server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailSubmissionSetMethod.scala:
##########
@@ -248,30 +252,54 @@ class EmailSubmissionSetMethod @Inject()(serializer: 
EmailSubmissionSetSerialize
   private def sendEmail(mailboxSession: MailboxSession,
                         request: EmailSubmissionCreationRequest): 
SMono[(EmailSubmissionCreationResponse, MessageId)] =
    for {
-      message <- 
SFlux(messageIdManager.getMessagesReactive(List(request.emailId).asJava, 
FetchGroup.FULL_CONTENT, mailboxSession))
+     message <- 
SFlux(messageIdManager.getMessagesReactive(List(request.emailId).asJava, 
FetchGroup.FULL_CONTENT, mailboxSession))

Review Comment:
   indent



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to