You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by GitBox <gi...@apache.org> on 2023/01/16 02:07:58 UTC

[GitHub] [james-project] vttranlina commented on a diff in pull request #1386: JAMES-3756 JMAP pushes should support delegation

vttranlina commented on code in PR #1386:
URL: https://github.com/apache/james-project/pull/1386#discussion_r1070752381


##########
server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/routes/EventSourceRoutes.scala:
##########
@@ -188,10 +190,11 @@ class EventSourceRoutes@Inject() (@Named(InjectionKeys.RFC_8621) val authenticat
       .asFlux()
       .subscribe(ping => context.outbound.emitNext(ping, FAIL_FAST))
 
-    SMono(
-      eventBus.register(
-        StateChangeListener(options.types, context.outbound),
-        AccountIdRegistrationKey.of(session.getUser)))
+    SMono.just(session.getUser)
+      .concatWith(SFlux.fromPublisher(delegationStore.delegatedUsers(session.getUser)))

Review Comment:
   `SFlux(delegationStore.delegatedUsers(session.getUser))`
   is better?



##########
server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/pushsubscription/PushListener.scala:
##########
@@ -58,15 +59,18 @@ object PushListener {
 }
 
 class PushListener @Inject()(pushRepository: PushSubscriptionRepository,
-                   webPushClient: WebPushClient,
-                   pushSerializer: PushSerializer) extends ReactiveGroupEventListener {
+                             webPushClient: WebPushClient,
+                             pushSerializer: PushSerializer,
+                             delegationStore: DelegationStore) extends ReactiveGroupEventListener {
 
   override def getDefaultGroup: Group = PushListenerGroup()
 
   override def reactiveEvent(event: Event): Publisher[Void] =
     event match {
       case event: StateChangeEvent =>
-        SFlux(pushRepository.list(event.username))
+        SMono.just(event.username)
+          .concatWith(delegationStore.authorizedUsers(event.username))

Review Comment:
   why we don't use 
   `SFlux(delegationStore.authorizedUsers(event.username)`



-- 
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: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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