You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2022/11/16 01:28:43 UTC

[james-project] 03/03: JAMES-3852 Support subscriptions management on delegated mailboxes

This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit e329ddd4bab93f54a7ae28934dcd51855ec232a9
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Fri Nov 11 16:12:31 2022 +0700

    JAMES-3852 Support subscriptions management on delegated mailboxes
    
    Subscriptions are distinct to the one of mailboxes with similar names
    in one's account.
---
 .../contract/MailboxSetMethodContract.scala        | 84 ++++++++++++++++++++--
 1 file changed, 77 insertions(+), 7 deletions(-)

diff --git a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/MailboxSetMethodContract.scala b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/MailboxSetMethodContract.scala
index 5ea41e8d7b..bed70285a0 100644
--- a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/MailboxSetMethodContract.scala
+++ b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/MailboxSetMethodContract.scala
@@ -4638,7 +4638,6 @@ trait MailboxSetMethodContract {
          |}""".stripMargin)
   }
 
-  @Disabled("JAMES-3359 The storage layer should rely on the mailbox path and not the name to allow handling of this case")
   @Test
   def updateShouldAllowDifferentIsSubscribedValuesWhenMailboxHaveTheSameName(server: GuiceJamesServer): Unit = {
     val andrePath = MailboxPath.forUser(ANDRE, "mailbox")
@@ -4669,9 +4668,43 @@ trait MailboxSetMethodContract {
          |         {
          |           "accountId": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
          |           "properties": ["id", "isSubscribed"],
-         |           "ids": ["${andreId.serialize}", "${bobId.serialize}"]
+         |           "ids": ["${andreId.serialize}"]
          |          },
-         |       "c4"]
+         |       "c3"],
+         |      ["Mailbox/get",
+         |         {
+         |           "accountId": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+         |           "properties": ["id", "isSubscribed"],
+         |           "ids": ["${bobId.serialize}"]
+         |          },
+         |       "c4"],
+         |      ["Mailbox/set",
+         |          {
+         |               "accountId": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+         |               "update": {
+         |                 "${andreId.serialize}" : {
+         |                   "isSubscribed": false
+         |                 },
+         |                 "${bobId.serialize}" : {
+         |                   "isSubscribed": true
+         |                 }
+         |               }
+         |          },
+         |   "c5"],
+         |      ["Mailbox/get",
+         |         {
+         |           "accountId": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+         |           "properties": ["id", "isSubscribed"],
+         |           "ids": ["${andreId.serialize}"]
+         |          },
+         |       "c6"],
+         |      ["Mailbox/get",
+         |         {
+         |           "accountId": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+         |           "properties": ["id", "isSubscribed"],
+         |           "ids": ["${bobId.serialize}"]
+         |          },
+         |       "c7"]
          |   ]
          |}
          |""".stripMargin
@@ -4689,7 +4722,17 @@ trait MailboxSetMethodContract {
       .body
       .asString
 
-    assertThatJson(response).isEqualTo(
+    assertThatJson(response)
+      .whenIgnoringPaths(
+        "methodResponses[0][1].newState",
+        "methodResponses[0][1].oldState",
+        "methodResponses[2][1].state",
+        "methodResponses[1][1].state",
+        "methodResponses[3][1].newState",
+        "methodResponses[3][1].oldState",
+        "methodResponses[4][1].state",
+        "methodResponses[5][1].state")
+      .isEqualTo(
       s"""{
          |  "sessionState": "${SESSION_STATE.value}",
          |  "methodResponses": [
@@ -4702,16 +4745,43 @@ trait MailboxSetMethodContract {
          |    }, "c2"],
          |    ["Mailbox/get", {
          |      "accountId": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
-         |      "state": "${INSTANCE.value}",
          |      "list": [{
          |        "id": "${andreId.serialize}",
          |        "isSubscribed": true
-         |      }, {
+         |      }],
+         |      "notFound": []
+         |    }, "c3"],
+         |    ["Mailbox/get", {
+         |      "accountId": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+         |      "list": [{
          |        "id": "${bobId.serialize}",
          |        "isSubscribed": false
          |      }],
          |      "notFound": []
-         |    }, "c4"]
+         |    }, "c4"],
+         |    ["Mailbox/set", {
+         |      "accountId": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+         |      "updated": {
+         |        "${andreId.serialize}": {},
+         |        "${bobId.serialize}": {}
+         |      }
+         |    }, "c5"],
+         |    ["Mailbox/get", {
+         |      "accountId": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+         |      "list": [{
+         |        "id": "${andreId.serialize}",
+         |        "isSubscribed": false
+         |      }],
+         |      "notFound": []
+         |    }, "c6"],
+         |    ["Mailbox/get", {
+         |      "accountId": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+         |      "list": [{
+         |        "id": "${bobId.serialize}",
+         |        "isSubscribed": true
+         |      }],
+         |      "notFound": []
+         |    }, "c7"]
          |  ]
          |}""".stripMargin)
   }


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