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 2021/12/02 08:25:59 UTC

[james-project] 01/03: JAMES-3534 - Fix the IDE Error

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 7a6c7a84fb4c73bfe16743360624fadd8c8ce742
Author: Tung Van TRAN <vt...@linagora.com>
AuthorDate: Mon Nov 29 13:52:41 2021 +0700

    JAMES-3534 - Fix the IDE Error
---
 .../jmap/api/identity/CustomIdentityDAO.scala      | 37 ++++++++++------------
 1 file changed, 17 insertions(+), 20 deletions(-)

diff --git a/server/data/data-jmap/src/main/scala/org/apache/james/jmap/api/identity/CustomIdentityDAO.scala b/server/data/data-jmap/src/main/scala/org/apache/james/jmap/api/identity/CustomIdentityDAO.scala
index 9b1a2a2..3f2e848 100644
--- a/server/data/data-jmap/src/main/scala/org/apache/james/jmap/api/identity/CustomIdentityDAO.scala
+++ b/server/data/data-jmap/src/main/scala/org/apache/james/jmap/api/identity/CustomIdentityDAO.scala
@@ -19,11 +19,6 @@
 
 package org.apache.james.jmap.api.identity
 
-import java.nio.charset.StandardCharsets
-import java.util.UUID
-import javax.inject.Inject
-
-import com.google.common.collect.ImmutableList
 import org.apache.james.core.{MailAddress, Username}
 import org.apache.james.jmap.api.identity.IdentityWithOrigin.IdentityWithOrigin
 import org.apache.james.jmap.api.model.{EmailAddress, ForbiddenSendFromException, HtmlSignature, Identity, IdentityId, IdentityName, MayDeleteIdentity, TextSignature}
@@ -33,7 +28,10 @@ import org.reactivestreams.Publisher
 import reactor.core.scala.publisher.{SFlux, SMono}
 import reactor.core.scheduler.Schedulers
 
-import scala.jdk.CollectionConverters._
+import java.nio.charset.StandardCharsets
+import java.util.UUID
+import javax.inject.Inject
+import scala.jdk.StreamConverters._
 import scala.util.Try
 
 case class IdentityCreationRequest(name: Option[IdentityName],
@@ -97,20 +95,19 @@ trait CustomIdentityDAO {
 }
 
 class DefaultIdentitySupplier @Inject()(canSendFrom: CanSendFrom, usersRepository: UsersRepository) {
-  def listIdentities(username: Username): List[Identity] =
-    canSendFrom.allValidFromAddressesForUser(username)
-      .collect(ImmutableList.toImmutableList()).asScala.toList
-      .flatMap(address =>
-        from(address).map(id =>
-          Identity(
-            id = id,
-            name = IdentityName(address.asString()),
-            email = address,
-            replyTo = None,
-            bcc = None,
-            textSignature = TextSignature.DEFAULT,
-            htmlSignature = HtmlSignature.DEFAULT,
-            mayDelete = MayDeleteIdentity(false))))
+  def listIdentities(username: Username): List[Identity] = canSendFrom.allValidFromAddressesForUser(username)
+    .toScala(LazyList).toList
+    .flatMap(address =>
+      from(address).map(id =>
+        Identity(
+          id = id,
+          name = IdentityName(address.asString()),
+          email = address,
+          replyTo = None,
+          bcc = None,
+          textSignature = TextSignature.DEFAULT,
+          htmlSignature = HtmlSignature.DEFAULT,
+          mayDelete = MayDeleteIdentity(false))))
 
   def userCanSendFrom(username: Username, mailAddress: MailAddress): Boolean =
     canSendFrom.userCanSendFrom(username, usersRepository.getUsername(mailAddress))

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