This is an automated email from the ASF dual-hosted git repository.
rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
The following commit(s) were added to refs/heads/master by this push:
new cc7ba60ce5 JAMES-3534 Fix Identity/set update when custom identity
cc7ba60ce5 is described below
commit cc7ba60ce59df308abc563ae5bb470086727efd6
Author: Tung Van TRAN <[email protected]>
AuthorDate: Fri Jul 15 13:51:08 2022 +0700
JAMES-3534 Fix Identity/set update when custom identity
---
.../jmap/api/identity/CustomIdentityDAO.scala | 2 +-
.../rfc8621/contract/IdentitySetContract.scala | 97 ++++++++++++++++++++++
2 files changed, 98 insertions(+), 1 deletion(-)
diff --git
a/server/data/data-jmap/src/main/scala/org/apache/james/jmap/api/identity/CustomIdentityDAO.scala
b/server/data/data-jmap/src/main/scala/org/apache/james/jmap/api/identity/CustomIdentityDAO.scala
index 0f55a94f42..5c3f26e735 100644
---
a/server/data/data-jmap/src/main/scala/org/apache/james/jmap/api/identity/CustomIdentityDAO.scala
+++
b/server/data/data-jmap/src/main/scala/org/apache/james/jmap/api/identity/CustomIdentityDAO.scala
@@ -173,8 +173,8 @@ class IdentityRepository @Inject()(customIdentityDao:
CustomIdentityDAO, identit
case (None, Some(customIdentity)) =>
identityFactory.userCanSendFrom(user, customIdentity.email)
.filter(bool => bool)
- .flatMap(_ => SMono(customIdentityDao.upsert(user,
identityUpdateRequest.update(customIdentity))))
.switchIfEmpty(SMono.error(IdentityNotFoundException(identityId)))
+ .flatMap(_ => SMono(customIdentityDao.upsert(user,
identityUpdateRequest.update(customIdentity))))
}
.`then`()
}
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/IdentitySetContract.scala
b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/IdentitySetContract.scala
index da0b516012..b473bbf1e2 100644
---
a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/IdentitySetContract.scala
+++
b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/IdentitySetContract.scala
@@ -926,6 +926,103 @@ trait IdentitySetContract {
|}""".stripMargin)
}
+ @Test
+ def updateShouldModifyIdentityEntryWhenBccNameIsNull(): Unit = {
+ val identityId: String = createNewIdentity()
+ val response: String = `given`
+ .body(
+ s"""{
+ | "using": [
+ | "urn:ietf:params:jmap:core",
+ | "urn:ietf:params:jmap:submission"
+ | ],
+ | "methodCalls": [
+ | [
+ | "Identity/set",
+ | {
+ | "accountId":
"29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+ | "update": {
+ | "$identityId": {
+ | "bcc": [
+ | {
+ | "name": null,
+ | "email": "[email protected]"
+ | }
+ | ]
+ | }
+ | }
+ | },
+ | "c1"
+ | ],
+ | [
+ | "Identity/get",
+ | {
+ | "accountId":
"29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+ | "ids": [
+ | "$identityId"
+ | ]
+ | },
+ | "c2"
+ | ]
+ | ]
+ |}""".stripMargin)
+ .when
+ .post
+ .`then`
+ .statusCode(SC_OK)
+ .contentType(JSON)
+ .extract
+ .body
+ .asString
+
+ assertThatJson(response)
+ .isEqualTo(s"""{
+ | "sessionState": "${SESSION_STATE.value}",
+ | "methodResponses": [
+ | [
+ | "Identity/set",
+ | {
+ | "accountId":
"29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+ | "newState":
"2c9f1b12-b35a-43e6-9af2-0106fb53a943",
+ | "updated": {
+ | "$identityId": { }
+ | }
+ | },
+ | "c1"
+ | ],
+ | [
+ | "Identity/get",
+ | {
+ | "accountId":
"29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+ | "state":
"2c9f1b12-b35a-43e6-9af2-0106fb53a943",
+ | "list": [
+ | {
+ | "name": "Bob",
+ | "htmlSignature": "<p>Some html
signature</p>",
+ | "id": "$identityId",
+ | "bcc": [
+ | {
+ | "email":
"[email protected]"
+ | }
+ | ],
+ | "textSignature": "Some text
signature",
+ | "mayDelete": true,
+ | "email": "[email protected]",
+ | "replyTo": [
+ | {
+ | "name": "Alice",
+ | "email":
"[email protected]"
+ | }
+ | ]
+ | }
+ | ]
+ | },
+ | "c2"
+ | ]
+ | ]
+ |}""".stripMargin)
+ }
+
@Test
def updateShouldNotUpdatedWhenIdNotfound(): Unit = {
val notfoundIdentityId: String = UUID.randomUUID().toString
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]