Arsnael commented on code in PR #2445:
URL: https://github.com/apache/james-project/pull/2445#discussion_r1810341763
##########
mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java:
##########
@@ -808,14 +808,23 @@ private Mono<MailboxCounters>
retrieveCounters(MessageMapper messageMapper, Mail
private Flux<Mailbox> searchMailboxes(MailboxQuery mailboxQuery,
MailboxSession session, Right right) {
MailboxMapper mailboxMapper =
mailboxSessionMapperFactory.getMailboxMapper(session);
- Flux<Mailbox> baseMailboxes = mailboxMapper
- .findMailboxWithPathLike(toSingleUserQuery(mailboxQuery, session));
+ Flux<Mailbox> baseMailboxes = getBaseMailboxes(mailboxMapper,
mailboxQuery, session);
Flux<Mailbox> delegatedMailboxes =
getDelegatedMailboxes(mailboxMapper, mailboxQuery, right, session)
.filter(Throwing.predicate(mailbox ->
storeRightManager.hasRight(mailbox, right, session)))
.filter(mailbox -> !mailbox.getUser().equals(session.getUser()));
return Flux.concat(baseMailboxes, delegatedMailboxes);
}
+ private Flux<Mailbox> getBaseMailboxes(MailboxMapper
mailboxMapper,MailboxQuery mailboxQuery, MailboxSession session) {
+ if (mailboxQuery.isPrivateMailboxes(session)) {
+ return
mailboxMapper.findMailboxWithPathLike(toSingleUserQuery(mailboxQuery, session));
+ } else if (mailboxQuery.getNamespace().isEmpty() &&
mailboxQuery.getUser().isEmpty()) {
+ return
mailboxMapper.findMailboxWithPathLike(toSingleUserQuery(mailboxQuery, session));
Review Comment:
if and else if returning same thing, can't we just have one condition
instead?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]