james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [3/8] james-project git commit: JAMES-2044 GetMessageList date filter should be done on sent date
Date Fri, 02 Jun 2017 12:02:18 GMT
JAMES-2044 GetMessageList date filter should be done on sent date


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/99148909
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/99148909
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/99148909

Branch: refs/heads/master
Commit: 99148909cb962ac71bfd545e3affda82c58f7b31
Parents: c24100f
Author: Antoine Duprat <aduprat@linagora.com>
Authored: Fri Jun 2 11:10:50 2017 +0200
Committer: Antoine Duprat <aduprat@linagora.com>
Committed: Fri Jun 2 11:10:50 2017 +0200

----------------------------------------------------------------------
 .../java/org/apache/james/jmap/utils/FilterToSearchQuery.java    | 4 ++--
 .../org/apache/james/jmap/utils/FilterToSearchQueryTest.java     | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/99148909/server/protocols/jmap/src/main/java/org/apache/james/jmap/utils/FilterToSearchQuery.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/utils/FilterToSearchQuery.java
b/server/protocols/jmap/src/main/java/org/apache/james/jmap/utils/FilterToSearchQuery.java
index b96d6a4..95799e4 100644
--- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/utils/FilterToSearchQuery.java
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/utils/FilterToSearchQuery.java
@@ -65,8 +65,8 @@ public class FilterToSearchQuery {
         filter.getBcc().ifPresent(bcc -> searchQuery.andCriteria(SearchQuery.address(AddressType.Bcc,
bcc)));
         filter.getSubject().ifPresent(subject -> searchQuery.andCriteria(SearchQuery.headerContains("Subject",
subject)));
         filter.getBody().ifPresent(body ->  searchQuery.andCriteria(SearchQuery.bodyContains(body)));
-        filter.getAfter().ifPresent(after -> searchQuery.andCriteria(SearchQuery.internalDateAfter(Date.from(after.toInstant()),
DateResolution.Second)));
-        filter.getBefore().ifPresent(before -> searchQuery.andCriteria(SearchQuery.internalDateBefore(Date.from(before.toInstant()),
DateResolution.Second)));
+        filter.getAfter().ifPresent(after -> searchQuery.andCriteria(SearchQuery.sentDateAfter(Date.from(after.toInstant()),
DateResolution.Second)));
+        filter.getBefore().ifPresent(before -> searchQuery.andCriteria(SearchQuery.sentDateBefore(Date.from(before.toInstant()),
DateResolution.Second)));
         filter.getHeader().ifPresent(header -> searchQuery.andCriteria(SearchQuery.headerContains(header.getName(),
header.getValue().orElse(null))));
         filter.getIsAnswered().ifPresent(isAnswered -> searchQuery.andCriteria(SearchQuery.flag(Flag.ANSWERED,
isAnswered)));
         filter.getIsDraft().ifPresent(isDraft -> searchQuery.andCriteria(SearchQuery.flag(Flag.DRAFT,
isDraft)));

http://git-wip-us.apache.org/repos/asf/james-project/blob/99148909/server/protocols/jmap/src/test/java/org/apache/james/jmap/utils/FilterToSearchQueryTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/utils/FilterToSearchQueryTest.java
b/server/protocols/jmap/src/test/java/org/apache/james/jmap/utils/FilterToSearchQueryTest.java
index 9b2eb17..eb05436 100644
--- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/utils/FilterToSearchQueryTest.java
+++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/utils/FilterToSearchQueryTest.java
@@ -181,7 +181,7 @@ public class FilterToSearchQueryTest {
     public void filterConditionShouldMapWhenAfter() {
         ZonedDateTime after = ZonedDateTime.now();
         SearchQuery expectedSearchQuery = new SearchQuery();
-        expectedSearchQuery.andCriteria(SearchQuery.internalDateAfter(Date.from(after.toInstant()),
DateResolution.Second));
+        expectedSearchQuery.andCriteria(SearchQuery.sentDateAfter(Date.from(after.toInstant()),
DateResolution.Second));
 
         SearchQuery searchQuery = new FilterToSearchQuery().convert(FilterCondition.builder()
                 .after(after)
@@ -194,7 +194,7 @@ public class FilterToSearchQueryTest {
     public void filterConditionShouldMapWhenBefore() {
         ZonedDateTime before = ZonedDateTime.now();
         SearchQuery expectedSearchQuery = new SearchQuery();
-        expectedSearchQuery.andCriteria(SearchQuery.internalDateBefore(Date.from(before.toInstant()),
DateResolution.Second));
+        expectedSearchQuery.andCriteria(SearchQuery.sentDateBefore(Date.from(before.toInstant()),
DateResolution.Second));
 
         SearchQuery searchQuery = new FilterToSearchQuery().convert(FilterCondition.builder()
                 .before(before)


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


Mime
View raw message