JAMES-2362 Relax constraint on In-Reply-To header which can be set by client to indicate the message is an answer
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/5e034b9f Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/5e034b9f Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/5e034b9f Branch: refs/heads/master Commit: 5e034b9f85fac097e6c763f9f771529f699e4106 Parents: b916edc Author: Raphael Ouazana <raphael.ouaz...@linagora.com> Authored: Wed Mar 21 15:37:14 2018 +0100 Committer: benwa <btell...@linagora.com> Committed: Tue Mar 27 15:16:32 2018 +0700 ---------------------------------------------------------------------- .../integration/SetMessagesMethodTest.java | 49 ++++++++++++++++++++ .../jmap/methods/MIMEMessageConverter.java | 1 - 2 files changed, 49 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/5e034b9f/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java ---------------------------------------------------------------------- diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java index dd57139..bdc88aa 100644 --- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java +++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java @@ -4536,6 +4536,55 @@ public abstract class SetMessagesMethodTest { } @Test + public void setMessagesShouldSetUserAddedHeadersForReplyAndForwardWhenAskedTo() throws Exception { + String messageCreationId = "creationId1337"; + String requestBody = "[" + + " [" + + " \"setMessages\"," + + " {" + + " \"create\": { \"" + messageCreationId + "\" : {" + + " \"from\": { \"name\": \"Me\", \"email\": \"" + USERNAME + "\"}," + + " \"to\": [{ \"name\": \"Me\", \"email\": \"" + USERNAME + "\"}]," + + " \"headers\": { \"In-Reply-To\": \"inreplyto value\", \"X-Forwarded-Message-Id\": \"forward value\"}," + + " \"subject\": \"Thank you for joining example.com!\"," + + " \"textBody\": \"Hello someone, and thank you for joining example.com!\"," + + " \"mailboxIds\": [\"" + getOutboxId(accessToken) + "\"]" + + " }}" + + " }," + + " \"#0\"" + + " ]" + + "]"; + + String messageId = given() + .header("Authorization", accessToken.serialize()) + .body(requestBody) + .when() + .post("/jmap") + .then() + .extract() + .body() + .<String>path(ARGUMENTS + ".created." + messageCreationId + ".id"); + + calmlyAwait.atMost(30, TimeUnit.SECONDS).until(() -> isAnyMessageFoundInInbox(accessToken)); + + String message = ARGUMENTS + ".list[0]"; + + with() + .header("Authorization", accessToken.serialize()) + .body("[[\"getMessages\", {\"ids\": [\"" + messageId + "\"]}, \"#0\"]]") + .when() + .post("/jmap") + .then() + .statusCode(200) + .log().ifValidationFails() + .body(NAME, equalTo("messages")) + .body(ARGUMENTS + ".list", hasSize(1)) + .body(message + ".headers", Matchers.allOf( + hasEntry("In-Reply-To", "inreplyto value"), + hasEntry("X-Forwarded-Message-Id", "forward value"))); + } + + @Test public void setMessagesShouldSetUserAddedHeadersInSent() throws Exception { String toUsername = "username1@" + USERS_DOMAIN; String password = "password"; http://git-wip-us.apache.org/repos/asf/james-project/blob/5e034b9f/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/MIMEMessageConverter.java ---------------------------------------------------------------------- diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/MIMEMessageConverter.java b/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/MIMEMessageConverter.java index 88cf504..63f999f 100644 --- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/MIMEMessageConverter.java +++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/MIMEMessageConverter.java @@ -91,7 +91,6 @@ public class MIMEMessageConverter { FieldName.SUBJECT, FieldName.MESSAGE_ID, FieldName.DATE, - IN_REPLY_TO_HEADER, FieldName.CONTENT_TYPE, FieldName.MIME_VERSION, FieldName.CONTENT_TRANSFER_ENCODING); --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org