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 2021/02/17 01:46:51 UTC
[james-project] 13/13: JAMES-2987
MessageMetadataView::isIsForwarded should be compatible with JMAP RFC-8621
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 9b0fbe58d5872dc7e43a68800250a86b04ae894f
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Tue Feb 9 14:04:11 2021 +0700
JAMES-2987 MessageMetadataView::isIsForwarded should be compatible with JMAP RFC-8621
JMAP RFC-8621 states that keywords shold be case insentive, lower case.
---
.../model/message/view/MessageMetadataView.java | 3 ++-
.../view/MessageMetadataViewFactoryTest.java | 23 ++++++++++++++++++++++
2 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/model/message/view/MessageMetadataView.java b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/model/message/view/MessageMetadataView.java
index c7d599e..130a7aa 100644
--- a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/model/message/view/MessageMetadataView.java
+++ b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/model/message/view/MessageMetadataView.java
@@ -156,7 +156,8 @@ public class MessageMetadataView implements MessageView {
}
public boolean isIsForwarded() {
- return keywords.contains(Keyword.FORWARDED);
+ return keywords.contains(Keyword.FORWARDED)
+ || keywords.contains(Keyword.of("$forwarded"));
}
public Number getSize() {
diff --git a/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/model/message/view/MessageMetadataViewFactoryTest.java b/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/model/message/view/MessageMetadataViewFactoryTest.java
index 19651ec..56736e8 100644
--- a/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/model/message/view/MessageMetadataViewFactoryTest.java
+++ b/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/model/message/view/MessageMetadataViewFactoryTest.java
@@ -20,6 +20,7 @@
package org.apache.james.jmap.draft.model.message.view;
import static org.apache.james.jmap.draft.model.message.view.MessageViewFixture.BOB;
+import static org.assertj.core.api.Assertions.assertThat;
import javax.mail.Flags;
@@ -85,6 +86,28 @@ class MessageMetadataViewFactoryTest {
}
@Test
+ void forwardedShouldBeReturnTrueWhenLowerCase() throws Exception {
+ ComposedMessageId message2 = bobInbox.appendMessage(MessageManager.AppendCommand.builder()
+ .withFlags(new Flags("$forwarded"))
+ .build("header: value\r\n\r\nbody"),
+ session).getId();
+
+ MessageMetadataView actual = testee.fromMessageIds(ImmutableList.of(message2.getMessageId()), session).collectList().block().get(0);
+ assertThat(actual.isIsForwarded()).isTrue();
+ }
+
+ @Test
+ void isForwardedShouldReturnTrueWhenUpperCase() throws Exception {
+ ComposedMessageId message2 = bobInbox.appendMessage(MessageManager.AppendCommand.builder()
+ .withFlags(new Flags("$Forwarded"))
+ .build("header: value\r\n\r\nbody"),
+ session).getId();
+
+ MessageMetadataView actual = testee.fromMessageIds(ImmutableList.of(message2.getMessageId()), session).collectList().block().get(0);
+ assertThat(actual.isIsForwarded()).isTrue();
+ }
+
+ @Test
void fromMessageResultsShouldCombineKeywords() throws Exception {
messageIdManager.setInMailboxes(message1.getMessageId(), ImmutableList.of(bobInbox.getId(), bobMailbox.getId()), session);
bobMailbox.setFlags(new Flags(Flags.Flag.FLAGGED), MessageManager.FlagsUpdateMode.REPLACE, MessageRange.all(), session);
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org