You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by rc...@apache.org on 2020/10/14 02:31:29 UTC
[james-project] 03/22: JAMES-3277 SetMessagesUpdateProcessor should
read outbox once
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
commit 2573cc65495b2c43d06e10a59a53467f6ad704bb
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Oct 12 06:30:00 2020 +0200
JAMES-3277 SetMessagesUpdateProcessor should read outbox once
A call remained, reading outbox for each updates entry
---
.../jmap/draft/methods/SetMessagesUpdateProcessor.java | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/methods/SetMessagesUpdateProcessor.java b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/methods/SetMessagesUpdateProcessor.java
index 5716a54..82d423e 100644
--- a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/methods/SetMessagesUpdateProcessor.java
+++ b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/methods/SetMessagesUpdateProcessor.java
@@ -149,7 +149,7 @@ public class SetMessagesUpdateProcessor implements SetMessagesProcessor {
SetMessagesResponse.Builder builder) {
try {
List<MessageResult> messages = messageIdManager.getMessage(messageId, FetchGroup.MINIMAL, mailboxSession);
- assertValidUpdate(messages, updateMessagePatch, mailboxSession);
+ assertValidUpdate(messages, updateMessagePatch, outboxes);
if (messages.isEmpty()) {
addMessageIdNotFoundToResponse(messageId, builder);
@@ -223,9 +223,9 @@ public class SetMessagesUpdateProcessor implements SetMessagesProcessor {
}
}
- private void assertValidUpdate(List<MessageResult> messagesToBeUpdated, UpdateMessagePatch updateMessagePatch, MailboxSession session) throws MailboxException {
- List<MailboxId> outboxMailboxes = mailboxIdFor(Role.OUTBOX, session);
-
+ private void assertValidUpdate(List<MessageResult> messagesToBeUpdated,
+ UpdateMessagePatch updateMessagePatch,
+ Set<MailboxId> outboxMailboxes) {
ImmutableList<MailboxId> previousMailboxes = messagesToBeUpdated.stream()
.map(MessageResult::getMailboxId)
.collect(Guavate.toImmutableList());
@@ -268,13 +268,6 @@ public class SetMessagesUpdateProcessor implements SetMessagesProcessor {
.orElse(previousMailboxes);
}
- private List<MailboxId> mailboxIdFor(Role role, MailboxSession session) throws MailboxException {
- return Flux.from(systemMailboxesProvider.getMailboxByRole(role, session.getUser()))
- .toStream()
- .map(MessageManager::getId)
- .collect(Guavate.toImmutableList());
- }
-
private MailImpl buildMailFromMessage(MessageResult message) throws MessagingException, IOException, MailboxException {
return MailImpl.fromMimeMessage(message.getMessageId().serialize(),
new MimeMessage(
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org