You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by GitBox <gi...@apache.org> on 2022/12/28 11:09:14 UTC

[GitHub] [james-project] quantranhong1999 opened a new pull request, #1366: JMAP: Add another read level to get attachment metadata without reading the email body

quantranhong1999 opened a new pull request, #1366:
URL: https://github.com/apache/james-project/pull/1366

   ### Why
   The idea is to allow fastly retrieve preview of a mail with attachment metadata with JMAP. e.g with GMAIL:
   ![image](https://user-images.githubusercontent.com/55171818/209802473-d39559c2-a97c-4aa3-9c39-462040dbe579.png)
   
   Nowadays, to fetch the `attachments` property, we use the FULL_CONTENT fetch type means fetching the body content while we don't need that in this case.
   
   We should introduce a JMAP read level that retrieves the `attachments` property without fetching the body of the mail.
   
   ### Todo
   - [ ] Jira ticket
   - [ ] Debug the JMAP distributed test failing when returning empty `attachments` property
   - [ ] Write more tests making sure the new FetchType work as expected
   - [ ] others...
   
   
   


-- 
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: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[GitHub] [james-project] chibenwa commented on a diff in pull request #1366: JMAP: Add another read level to get attachment metadata without reading the email body

Posted by GitBox <gi...@apache.org>.
chibenwa commented on code in PR #1366:
URL: https://github.com/apache/james-project/pull/1366#discussion_r1058683572


##########
server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailGetMethodContract.scala:
##########
@@ -4488,6 +4488,121 @@ trait EmailGetMethodContract {
          |}""".stripMargin)
   }
 
+  @Test
+  def fastViewWithAttachmentMetadataCase(server: GuiceJamesServer): Unit = {
+    // TODO debug this: failing on Distributed test with empty attachments
+    val path = MailboxPath.inbox(BOB)
+    server.getProbe(classOf[MailboxProbeImpl]).createMailbox(path)
+    val messageId: MessageId = server.getProbe(classOf[MailboxProbeImpl])
+      .appendMessage(BOB.asString, path, AppendCommand.from(
+        ClassLoaderUtils.getSystemResourceAsSharedStream("eml/inlined-mixed.eml")))
+      .getMessageId
+
+    val request =
+      s"""{
+         |  "using": [
+         |    "urn:ietf:params:jmap:core",
+         |    "urn:ietf:params:jmap:mail"],
+         |  "methodCalls": [[
+         |    "Email/get",
+         |    {
+         |      "accountId": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+         |      "ids": ["${messageId.serialize}"],
+         |      "properties":[
+         |					"id",
+         |					"subject",
+         |					"from",
+         |					"to",
+         |					"cc",
+         |					"bcc",
+         |					"keywords",
+         |					"size",
+         |					"receivedAt",
+         |					"sentAt",
+         |					"preview",
+         |					"hasAttachment",
+         |          "attachments",

Review Comment:
   Ident



##########
server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailGetMethodContract.scala:
##########
@@ -4488,6 +4488,121 @@ trait EmailGetMethodContract {
          |}""".stripMargin)
   }
 
+  @Test
+  def fastViewWithAttachmentMetadataCase(server: GuiceJamesServer): Unit = {
+    // TODO debug this: failing on Distributed test with empty attachments
+    val path = MailboxPath.inbox(BOB)
+    server.getProbe(classOf[MailboxProbeImpl]).createMailbox(path)
+    val messageId: MessageId = server.getProbe(classOf[MailboxProbeImpl])
+      .appendMessage(BOB.asString, path, AppendCommand.from(
+        ClassLoaderUtils.getSystemResourceAsSharedStream("eml/inlined-mixed.eml")))
+      .getMessageId
+
+    val request =
+      s"""{
+         |  "using": [
+         |    "urn:ietf:params:jmap:core",
+         |    "urn:ietf:params:jmap:mail"],
+         |  "methodCalls": [[
+         |    "Email/get",
+         |    {
+         |      "accountId": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+         |      "ids": ["${messageId.serialize}"],
+         |      "properties":[
+         |					"id",
+         |					"subject",
+         |					"from",
+         |					"to",
+         |					"cc",
+         |					"bcc",
+         |					"keywords",
+         |					"size",
+         |					"receivedAt",
+         |					"sentAt",
+         |					"preview",
+         |					"hasAttachment",
+         |          "attachments",
+         |					"replyTo",
+         |					"mailboxIds"
+         |				],
+         |      "fetchTextBodyValues": true
+         |    },
+         |    "c1"]]
+         |}""".stripMargin
+    val response = `given`
+      .header(ACCEPT.toString, ACCEPT_RFC8621_VERSION_HEADER)
+      .body(request)
+    .when
+      .post.prettyPeek()

Review Comment:
   deug



-- 
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: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[GitHub] [james-project] chibenwa merged pull request #1366: JAMES-3872 Add another read level to get attachment metadata without reading the email body

Posted by GitBox <gi...@apache.org>.
chibenwa merged PR #1366:
URL: https://github.com/apache/james-project/pull/1366


-- 
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: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[GitHub] [james-project] quantranhong1999 commented on a diff in pull request #1366: JMAP: Add another read level to get attachment metadata without reading the email body

Posted by GitBox <gi...@apache.org>.
quantranhong1999 commented on code in PR #1366:
URL: https://github.com/apache/james-project/pull/1366#discussion_r1060465222


##########
mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAO.java:
##########
@@ -324,6 +324,7 @@ private Mono<byte[]> buildContentRetriever(FetchType fetchType, BlobId headerId,
         switch (fetchType) {
             case FULL:
                 return getFullContent(headerId, bodyId);
+            case ATTACHMENTS_METADATA:

Review Comment:
   Not here. There diff come from this: https://github.com/apache/james-project/pull/1366/files#diff-d217454c389000012a2f12f4f04e3a87d296176626e7c72ac6e9cf848515802aR56 where we load the attachments metadata
   



-- 
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: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[GitHub] [james-project] chibenwa commented on pull request #1366: JMAP: Add another read level to get attachment metadata without reading the email body

Posted by GitBox <gi...@apache.org>.
chibenwa commented on PR #1366:
URL: https://github.com/apache/james-project/pull/1366#issuecomment-1367018263

   <div id="description"><div class="jenkins-buttons-row jenkins-buttons-row--invert"></div></div>
   <h3>Error Message</h3><pre>Expecting actual:
     [METADATA, HEADERS, ATTACHMENTS_METADATA, FULL]
   to contain exactly (and in same order):
     [METADATA, HEADERS, FULL]
   but some elements were not expected:
     [ATTACHMENTS_METADATA]
   </pre><h3>Stacktrace</h3><pre>java.lang.AssertionError: 
   
   Expecting actual:
     [METADATA, HEADERS, ATTACHMENTS_METADATA, FULL]
   to contain exactly (and in same order):
     [METADATA, HEADERS, FULL]
   but some elements were not expected:
     [ATTACHMENTS_METADATA]
   
   	at org.apache.james.mailbox.store.search.SimpleMessageSearchIndexTest.canCompareFetchTypes(SimpleMessageSearchIndexTest.java:242)
   </pre>


-- 
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: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[GitHub] [james-project] vttranlina commented on a diff in pull request #1366: JMAP: Add another read level to get attachment metadata without reading the email body

Posted by GitBox <gi...@apache.org>.
vttranlina commented on code in PR #1366:
URL: https://github.com/apache/james-project/pull/1366#discussion_r1058711824


##########
mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAO.java:
##########
@@ -324,6 +324,7 @@ private Mono<byte[]> buildContentRetriever(FetchType fetchType, BlobId headerId,
         switch (fetchType) {
             case FULL:
                 return getFullContent(headerId, bodyId);
+            case ATTACHMENTS_METADATA:

Review Comment:
   If I am correct, we will have a separate method (eg: `getContent(headerId...)`) for `ATTACHMENTS_METADATA`. Correct?



-- 
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: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org