james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject james-project git commit: JAMES-1751 JMAP utils should not list all mailboxes to retrieve mailbox ID
Date Mon, 06 Jun 2016 10:41:34 GMT
Repository: james-project
Updated Branches:
  refs/heads/master 57ef34a75 -> 74fd6c223


JAMES-1751 JMAP utils should not list all mailboxes to retrieve mailbox ID

Current implementation do not support shared mailboxes and retrieves only user mailboxes.
It is not optimal though...


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

Branch: refs/heads/master
Commit: 74fd6c22329aa35717dd8168b46835ae9426a2bb
Parents: 57ef34a
Author: Benoit Tellier <btellier@linagora.com>
Authored: Mon Jun 6 13:46:03 2016 +0700
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Mon Jun 6 17:40:36 2016 +0700

----------------------------------------------------------------------
 .../src/main/java/org/apache/james/jmap/utils/MailboxUtils.java  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/74fd6c22/server/protocols/jmap/src/main/java/org/apache/james/jmap/utils/MailboxUtils.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/utils/MailboxUtils.java
b/server/protocols/jmap/src/main/java/org/apache/james/jmap/utils/MailboxUtils.java
index 1e38f44..849e959 100644
--- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/utils/MailboxUtils.java
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/utils/MailboxUtils.java
@@ -46,6 +46,7 @@ public class MailboxUtils {
 
     private static final boolean DONT_RESET_RECENT = false;
     private static final Logger LOGGER = LoggerFactory.getLogger(MailboxUtils.class);
+    private static final String WILDCARD = "%";
 
     private final MailboxManager mailboxManager;
     private final MailboxMapperFactory mailboxMapperFactory;
@@ -105,7 +106,8 @@ public class MailboxUtils {
 
     private Optional<org.apache.james.mailbox.store.mail.model.Mailbox> getMailboxFromId(String
mailboxId, MailboxSession mailboxSession) throws MailboxException {
         return mailboxMapperFactory.getMailboxMapper(mailboxSession)
-                .list().stream()
+                .findMailboxWithPathLike(new MailboxPath(mailboxSession.getPersonalSpace(),
mailboxSession.getUser().getUserName(), WILDCARD))
+                .stream()
                 .filter(mailbox -> mailbox.getMailboxId().serialize().equals(mailboxId))
                 .findFirst();
     }


---------------------------------------------------------------------
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