1 /*
2  *  Make.org Core API
3  *  Copyright (C) 2018 Make.org
4  *
5  * This program is free software: you can redistribute it and/or modify
6  *  it under the terms of the GNU Affero General Public License as
7  *  published by the Free Software Foundation, either version 3 of the
8  *  License, or (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU Affero General Public License for more details.
14  *
15  *  You should have received a copy of the GNU Affero General Public License
16  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.
17  *
18  */
19 
20 package org.make.api.userhistory
21 
22 import cats.implicits._
23 import akka.actor.typed.ActorRef
24 import akka.stream.scaladsl.{Sink, Source}
25 import akka.util.Timeout
26 import org.make.api.extensions.MakeSettingsComponent
27 import org.make.api.sessionhistory.Ack
28 import org.make.api.technical.BetterLoggingActors._
29 import org.make.api.technical.{ActorSystemComponent, MakePersistentActor, StreamUtils, TimeSettings}
30 import org.make.core.technical.Pagination
31 import org.make.core.history.HistoryActions.VoteAndQualifications
32 import org.make.core.proposal.{ProposalId, QualificationKey, VoteKey}
33 import org.make.core.user._
34 import org.make.core.{ValidationError, ValidationFailedError}
35 
36 import scala.concurrent.ExecutionContext.Implicits.global
37 import scala.concurrent.Future
38 
39 trait UserHistoryCoordinatorComponent {
40   def userHistoryCoordinator: ActorRef[UserHistoryCommand]
41 }
42 
43 trait UserHistoryCoordinatorService {
44   def logHistory(event: UserHistoryEvent[_]): Unit
45   def logTransactionalHistory(event: TransactionalUserHistoryEvent[_]): Future[Unit]
46   def retrieveVoteAndQualifications(
47     userId: UserId,
48     proposalIds: Seq[ProposalId]
49   ): Future[Map[ProposalId, VoteAndQualifications]]
50   def retrieveVotedProposals(request: RequestUserVotedProposals): Future[Seq[ProposalId]]
51   def delete(userId: UserId): Future[Unit]
52 }
53 
54 trait UserHistoryCoordinatorServiceComponent {
55   def userHistoryCoordinatorService: UserHistoryCoordinatorService
56 }
57 
58 trait DefaultUserHistoryCoordinatorServiceComponent extends UserHistoryCoordinatorServiceComponent {
59   self: UserHistoryCoordinatorComponent with ActorSystemComponent with MakeSettingsComponent =>
60 
61   override lazy val userHistoryCoordinatorService: UserHistoryCoordinatorService =
62     new DefaultUserHistoryCoordinatorService
63 
64   class DefaultUserHistoryCoordinatorService extends UserHistoryCoordinatorService {
65 
66     private val proposalsPerPage: Int = makeSettings.maxHistoryProposalsPerPage
67     implicit val timeout: Timeout = TimeSettings.defaultTimeout
68 
69     override def logHistory(event: UserHistoryEvent[_]): Unit = {
70       userHistoryCoordinator ! UserHistoryEnvelope(event.userId, event)
71     }
72 
73     override def logTransactionalHistory(event: TransactionalUserHistoryEvent[_]): Future[Unit] = {
74       (userHistoryCoordinator ?? { replyTo: ActorRef[UserHistoryResponse[Ack.type]] =>
75         UserHistoryTransactionalEnvelope(event.userId, event, replyTo)
76       }).void
77     }
78 
79     override def retrieveVoteAndQualifications(
80       userId: UserId,
81       proposalIds: Seq[ProposalId]
82     ): Future[Map[ProposalId, VoteAndQualifications]] = {
83       (userHistoryCoordinator ?? (RequestVoteValues(userId, proposalIds, _))).flatMap(shapeResponse)
84     }
85 
86     private def retrieveVotedProposalsPage(request: RequestUserVotedProposals, offset: Int): Future[Seq[ProposalId]] = {
87       def requestPaginate(
88         proposalsIds: Option[Seq[ProposalId]],
89         replyTo: ActorRef[UserHistoryResponse[Seq[ProposalId]]]
90       ) =
91         RequestUserVotedProposalsPaginate(
92           userId = request.userId,
93           filterVotes = request.filterVotes,
94           filterQualifications = request.filterQualifications,
95           proposalsIds = proposalsIds,
96           limit = Pagination.Limit(proposalsPerPage),
97           offset = Pagination.Offset(offset),
98           replyTo
99         )
100       request.proposalsIds match {
101         case Some(proposalsIds) if proposalsIds.sizeIs > proposalsPerPage =>
102           Source(proposalsIds)
103             .sliding(proposalsPerPage, proposalsPerPage)
104             .mapAsync(5) { someProposalsIds =>
105               (userHistoryCoordinator ?? (requestPaginate(Some(someProposalsIds), _)))
106                 .flatMap(shapeResponse)
107             }
108             .mapConcat(identity)
109             .runWith(Sink.seq)
110         case _ =>
111           (userHistoryCoordinator ?? (requestPaginate(request.proposalsIds, _))).flatMap(shapeResponse)
112       }
113     }
114 
115     override def retrieveVotedProposals(request: RequestUserVotedProposals): Future[Seq[ProposalId]] = {
116       StreamUtils
117         .asyncPageToPageSource(retrieveVotedProposalsPage(request, _))
118         .mapConcat(identity)
119         .runWith(Sink.seq)
120     }
121 
122     override def delete(userId: UserId): Future[Unit] =
123       (userHistoryCoordinator ?? (Stop(userId, _))) >>
124         MakePersistentActor.delete(userId, UserHistoryActor.JournalPluginId)
125 
126     private def shapeResponse[T](response: UserHistoryResponse[T]): Future[T] = response match {
127       case UserHistoryResponse(value) => Future.successful(value)
128       case other =>
129         Future.failed(
130           ValidationFailedError(errors = Seq(ValidationError("status", "invalid_state", Some(other.toString))))
131         )
132     }
133   }
134 }
135 
136 final case class RequestUserVotedProposals(
137   userId: UserId,
138   filterVotes: Option[Seq[VoteKey]] = None,
139   filterQualifications: Option[Seq[QualificationKey]] = None,
140   proposalsIds: Option[Seq[ProposalId]] = None
141 )
Line Stmt Id Pos Tree Symbol Tests Code
66 18403 2632 - 2671 Select org.make.api.extensions.MakeSettings.maxHistoryProposalsPerPage org.make.api.userhistory.userhistorycoordinatortest DefaultUserHistoryCoordinatorServiceComponent.this.makeSettings.maxHistoryProposalsPerPage
67 14826 2708 - 2735 Select org.make.api.technical.TimeSettings.defaultTimeout org.make.api.userhistory.userhistorycoordinatortest org.make.api.technical.TimeSettings.defaultTimeout
70 10760 2809 - 2831 Select org.make.api.userhistory.UserHistoryCoordinatorComponent.userHistoryCoordinator DefaultUserHistoryCoordinatorServiceComponent.this.userHistoryCoordinator
70 8974 2854 - 2866 Select org.make.api.userhistory.UserPersistentEvent.userId event.userId
70 15346 2834 - 2874 Apply org.make.api.userhistory.UserHistoryEnvelope.apply UserHistoryEnvelope.apply[org.make.api.userhistory.UserHistoryEvent[_$3]](event.userId, event)
70 11852 2809 - 2874 Apply akka.actor.typed.ActorRef.ActorRefOps.! typed.this.ActorRef.ActorRefOps[org.make.api.userhistory.UserHistoryCommand](DefaultUserHistoryCoordinatorServiceComponent.this.userHistoryCoordinator).!(UserHistoryEnvelope.apply[org.make.api.userhistory.UserHistoryEvent[_$3]](event.userId, event))
74 11737 3012 - 3012 ApplyToImplicitArgs cats.instances.FutureInstances.catsStdInstancesForFuture org.make.api.userhistory.userhistorycoordinatortest cats.implicits.catsStdInstancesForFuture(scala.concurrent.ExecutionContext.Implicits.global)
74 11100 3012 - 3012 Select org.make.api.userhistory.DefaultUserHistoryCoordinatorServiceComponent.DefaultUserHistoryCoordinatorService.timeout org.make.api.userhistory.userhistorycoordinatortest DefaultUserHistoryCoordinatorService.this.timeout
74 8875 2989 - 3147 ApplyToImplicitArgs org.make.api.technical.BetterLoggingActors.BetterLoggingTypedActorRef.?? org.make.api.userhistory.userhistorycoordinatortest org.make.api.technical.BetterLoggingActors.BetterLoggingTypedActorRef[org.make.api.userhistory.UserHistoryCommand](DefaultUserHistoryCoordinatorServiceComponent.this.userHistoryCoordinator).??[org.make.api.userhistory.UserHistoryResponse[org.make.api.sessionhistory.Ack.type]](((replyTo: akka.actor.typed.ActorRef[org.make.api.userhistory.UserHistoryResponse[org.make.api.sessionhistory.Ack.type]]) => UserHistoryTransactionalEnvelope.apply[org.make.api.userhistory.TransactionalUserHistoryEvent[_$4]](event.userId, event, replyTo)))(scala.concurrent.ExecutionContext.Implicits.global, DefaultUserHistoryCoordinatorServiceComponent.this.actorSystem, DefaultUserHistoryCoordinatorService.this.timeout)
74 18301 3012 - 3012 Select scala.concurrent.ExecutionContext.Implicits.global org.make.api.userhistory.userhistorycoordinatortest scala.concurrent.ExecutionContext.Implicits.global
74 15358 3012 - 3012 Select scala.concurrent.ExecutionContext.Implicits.global org.make.api.userhistory.userhistorycoordinatortest scala.concurrent.ExecutionContext.Implicits.global
74 14840 3012 - 3012 Select org.make.api.technical.ActorSystemComponent.actorSystem org.make.api.userhistory.userhistorycoordinatortest DefaultUserHistoryCoordinatorServiceComponent.this.actorSystem
74 17651 2989 - 3011 Select org.make.api.userhistory.UserHistoryCoordinatorComponent.userHistoryCoordinator org.make.api.userhistory.userhistorycoordinatortest DefaultUserHistoryCoordinatorServiceComponent.this.userHistoryCoordinator
75 15460 3110 - 3122 Select org.make.api.userhistory.UserPersistentEvent.userId org.make.api.userhistory.userhistorycoordinatortest event.userId
75 11992 3077 - 3139 Apply org.make.api.userhistory.UserHistoryTransactionalEnvelope.apply org.make.api.userhistory.userhistorycoordinatortest UserHistoryTransactionalEnvelope.apply[org.make.api.userhistory.TransactionalUserHistoryEvent[_$4]](event.userId, event, replyTo)
76 17529 2989 - 3153 Select cats.Functor.Ops.void org.make.api.userhistory.userhistorycoordinatortest cats.implicits.toFunctorOps[scala.concurrent.Future, org.make.api.userhistory.UserHistoryResponse[org.make.api.sessionhistory.Ack.type]](org.make.api.technical.BetterLoggingActors.BetterLoggingTypedActorRef[org.make.api.userhistory.UserHistoryCommand](DefaultUserHistoryCoordinatorServiceComponent.this.userHistoryCoordinator).??[org.make.api.userhistory.UserHistoryResponse[org.make.api.sessionhistory.Ack.type]](((replyTo: akka.actor.typed.ActorRef[org.make.api.userhistory.UserHistoryResponse[org.make.api.sessionhistory.Ack.type]]) => UserHistoryTransactionalEnvelope.apply[org.make.api.userhistory.TransactionalUserHistoryEvent[_$4]](event.userId, event, replyTo)))(scala.concurrent.ExecutionContext.Implicits.global, DefaultUserHistoryCoordinatorServiceComponent.this.actorSystem, DefaultUserHistoryCoordinatorService.this.timeout))(cats.implicits.catsStdInstancesForFuture(scala.concurrent.ExecutionContext.Implicits.global)).void
83 14112 3331 - 3353 Select org.make.api.userhistory.UserHistoryCoordinatorComponent.userHistoryCoordinator org.make.api.userhistory.userhistorycoordinatortest,org.scalatest.testsuite DefaultUserHistoryCoordinatorServiceComponent.this.userHistoryCoordinator
83 9231 3410 - 3423 Apply org.make.api.userhistory.DefaultUserHistoryCoordinatorServiceComponent.DefaultUserHistoryCoordinatorService.shapeResponse DefaultUserHistoryCoordinatorService.this.shapeResponse[Map[org.make.core.proposal.ProposalId,org.make.core.history.HistoryActions.VoteAndQualifications]](response)
83 15263 3409 - 3409 Select scala.concurrent.ExecutionContext.Implicits.global org.make.api.userhistory.userhistorycoordinatortest,org.scalatest.testsuite scala.concurrent.ExecutionContext.Implicits.global
83 14602 3354 - 3354 Select org.make.api.technical.ActorSystemComponent.actorSystem org.make.api.userhistory.userhistorycoordinatortest,org.scalatest.testsuite DefaultUserHistoryCoordinatorServiceComponent.this.actorSystem
83 18310 3354 - 3354 Select scala.concurrent.ExecutionContext.Implicits.global org.make.api.userhistory.userhistorycoordinatortest,org.scalatest.testsuite scala.concurrent.ExecutionContext.Implicits.global
83 12263 3358 - 3399 Apply org.make.api.userhistory.RequestVoteValues.apply org.make.api.userhistory.userhistorycoordinatortest,org.scalatest.testsuite RequestVoteValues.apply(userId, proposalIds, x$1)
83 10973 3354 - 3354 Select org.make.api.userhistory.DefaultUserHistoryCoordinatorServiceComponent.DefaultUserHistoryCoordinatorService.timeout org.make.api.userhistory.userhistorycoordinatortest,org.scalatest.testsuite DefaultUserHistoryCoordinatorService.this.timeout
83 11750 3331 - 3424 ApplyToImplicitArgs scala.concurrent.Future.flatMap org.make.api.userhistory.userhistorycoordinatortest,org.scalatest.testsuite org.make.api.technical.BetterLoggingActors.BetterLoggingTypedActorRef[org.make.api.userhistory.UserHistoryCommand](DefaultUserHistoryCoordinatorServiceComponent.this.userHistoryCoordinator).??[org.make.api.userhistory.UserHistoryResponse[Map[org.make.core.proposal.ProposalId,org.make.core.history.HistoryActions.VoteAndQualifications]]](((x$1: akka.actor.typed.ActorRef[org.make.api.userhistory.UserHistoryResponse[Map[org.make.core.proposal.ProposalId,org.make.core.history.HistoryActions.VoteAndQualifications]]]) => RequestVoteValues.apply(userId, proposalIds, x$1)))(scala.concurrent.ExecutionContext.Implicits.global, DefaultUserHistoryCoordinatorServiceComponent.this.actorSystem, DefaultUserHistoryCoordinatorService.this.timeout).flatMap[Map[org.make.core.proposal.ProposalId,org.make.core.history.HistoryActions.VoteAndQualifications]](((response: org.make.api.userhistory.UserHistoryResponse[Map[org.make.core.proposal.ProposalId,org.make.core.history.HistoryActions.VoteAndQualifications]]) => DefaultUserHistoryCoordinatorService.this.shapeResponse[Map[org.make.core.proposal.ProposalId,org.make.core.history.HistoryActions.VoteAndQualifications]](response)))(scala.concurrent.ExecutionContext.Implicits.global)
91 9461 3709 - 4053 Apply org.make.api.userhistory.RequestUserVotedProposalsPaginate.apply RequestUserVotedProposalsPaginate.apply(request.userId, request.filterVotes, request.filterQualifications, proposalsIds, org.make.core.technical.Pagination.Limit.apply(DefaultUserHistoryCoordinatorService.this.proposalsPerPage), org.make.core.technical.Pagination.Offset.apply(offset), replyTo)
92 17544 3763 - 3777 Select org.make.api.userhistory.RequestUserVotedProposals.userId request.userId
93 13995 3803 - 3822 Select org.make.api.userhistory.RequestUserVotedProposals.filterVotes request.filterVotes
94 11973 3857 - 3885 Select org.make.api.userhistory.RequestUserVotedProposals.filterQualifications request.filterQualifications
96 14504 3944 - 3978 Apply org.make.core.technical.Pagination.Limit.apply org.make.core.technical.Pagination.Limit.apply(DefaultUserHistoryCoordinatorService.this.proposalsPerPage)
96 18321 3961 - 3977 Select org.make.api.userhistory.DefaultUserHistoryCoordinatorServiceComponent.DefaultUserHistoryCoordinatorService.proposalsPerPage DefaultUserHistoryCoordinatorService.this.proposalsPerPage
97 10991 3999 - 4024 Apply org.make.core.technical.Pagination.Offset.apply org.make.core.technical.Pagination.Offset.apply(offset)
100 14979 4060 - 4080 Select org.make.api.userhistory.RequestUserVotedProposals.proposalsIds request.proposalsIds
101 17435 4124 - 4162 Apply scala.collection.IterableOps.SizeCompareOps.> proposalsIds.sizeIs.>(DefaultUserHistoryCoordinatorService.this.proposalsPerPage)
101 11552 4146 - 4162 Select org.make.api.userhistory.DefaultUserHistoryCoordinatorServiceComponent.DefaultUserHistoryCoordinatorService.proposalsPerPage DefaultUserHistoryCoordinatorService.this.proposalsPerPage
103 11866 4236 - 4252 Select org.make.api.userhistory.DefaultUserHistoryCoordinatorServiceComponent.DefaultUserHistoryCoordinatorService.proposalsPerPage DefaultUserHistoryCoordinatorService.this.proposalsPerPage
103 14012 4218 - 4234 Select org.make.api.userhistory.DefaultUserHistoryCoordinatorServiceComponent.DefaultUserHistoryCoordinatorService.proposalsPerPage DefaultUserHistoryCoordinatorService.this.proposalsPerPage
104 17953 4276 - 4277 Literal <nosymbol> 5
105 15000 4339 - 4339 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
105 10873 4359 - 4381 Apply scala.Some.apply scala.Some.apply[Seq[org.make.core.proposal.ProposalId]](someProposalsIds)
105 17452 4339 - 4339 Select org.make.api.userhistory.DefaultUserHistoryCoordinatorServiceComponent.DefaultUserHistoryCoordinatorService.timeout DefaultUserHistoryCoordinatorService.this.timeout
105 14515 4316 - 4338 Select org.make.api.userhistory.UserHistoryCoordinatorComponent.userHistoryCoordinator DefaultUserHistoryCoordinatorServiceComponent.this.userHistoryCoordinator
105 16734 4343 - 4385 Apply org.make.api.userhistory.DefaultUserHistoryCoordinatorServiceComponent.DefaultUserHistoryCoordinatorService.requestPaginate requestPaginate(scala.Some.apply[Seq[org.make.core.proposal.ProposalId]](someProposalsIds), x$2)
105 11733 4339 - 4339 Select org.make.api.technical.ActorSystemComponent.actorSystem DefaultUserHistoryCoordinatorServiceComponent.this.actorSystem
106 17970 4316 - 4427 ApplyToImplicitArgs scala.concurrent.Future.flatMap org.make.api.technical.BetterLoggingActors.BetterLoggingTypedActorRef[org.make.api.userhistory.UserHistoryCommand](DefaultUserHistoryCoordinatorServiceComponent.this.userHistoryCoordinator).??[org.make.api.userhistory.UserHistoryResponse[Seq[org.make.core.proposal.ProposalId]]](((x$2: akka.actor.typed.ActorRef[org.make.api.userhistory.UserHistoryResponse[Seq[org.make.core.proposal.ProposalId]]]) => requestPaginate(scala.Some.apply[Seq[org.make.core.proposal.ProposalId]](someProposalsIds), x$2)))(scala.concurrent.ExecutionContext.Implicits.global, DefaultUserHistoryCoordinatorServiceComponent.this.actorSystem, DefaultUserHistoryCoordinatorService.this.timeout).flatMap[Seq[org.make.core.proposal.ProposalId]](((response: org.make.api.userhistory.UserHistoryResponse[Seq[org.make.core.proposal.ProposalId]]) => DefaultUserHistoryCoordinatorService.this.shapeResponse[Seq[org.make.core.proposal.ProposalId]](response)))(scala.concurrent.ExecutionContext.Implicits.global)
106 14261 4413 - 4426 Apply org.make.api.userhistory.DefaultUserHistoryCoordinatorServiceComponent.DefaultUserHistoryCoordinatorService.shapeResponse DefaultUserHistoryCoordinatorService.this.shapeResponse[Seq[org.make.core.proposal.ProposalId]](response)
106 11880 4412 - 4412 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
108 14714 4465 - 4473 Apply scala.Predef.identity scala.Predef.identity[Seq[org.make.core.proposal.ProposalId]](x)
109 17222 4495 - 4495 Select org.make.api.technical.ActorSystemComponent.actorSystem DefaultUserHistoryCoordinatorServiceComponent.this.actorSystem
109 11745 4176 - 4505 ApplyToImplicitArgs akka.stream.scaladsl.Source.runWith akka.stream.scaladsl.Source.apply[org.make.core.proposal.ProposalId](proposalsIds).sliding(DefaultUserHistoryCoordinatorService.this.proposalsPerPage, DefaultUserHistoryCoordinatorService.this.proposalsPerPage).mapAsync[Seq[org.make.core.proposal.ProposalId]](5)(((someProposalsIds: Seq[org.make.core.proposal.ProposalId]) => org.make.api.technical.BetterLoggingActors.BetterLoggingTypedActorRef[org.make.api.userhistory.UserHistoryCommand](DefaultUserHistoryCoordinatorServiceComponent.this.userHistoryCoordinator).??[org.make.api.userhistory.UserHistoryResponse[Seq[org.make.core.proposal.ProposalId]]](((x$2: akka.actor.typed.ActorRef[org.make.api.userhistory.UserHistoryResponse[Seq[org.make.core.proposal.ProposalId]]]) => requestPaginate(scala.Some.apply[Seq[org.make.core.proposal.ProposalId]](someProposalsIds), x$2)))(scala.concurrent.ExecutionContext.Implicits.global, DefaultUserHistoryCoordinatorServiceComponent.this.actorSystem, DefaultUserHistoryCoordinatorService.this.timeout).flatMap[Seq[org.make.core.proposal.ProposalId]](((response: org.make.api.userhistory.UserHistoryResponse[Seq[org.make.core.proposal.ProposalId]]) => DefaultUserHistoryCoordinatorService.this.shapeResponse[Seq[org.make.core.proposal.ProposalId]](response)))(scala.concurrent.ExecutionContext.Implicits.global))).mapConcat[org.make.core.proposal.ProposalId](((x: Seq[org.make.core.proposal.ProposalId]) => scala.Predef.identity[Seq[org.make.core.proposal.ProposalId]](x))).runWith[scala.concurrent.Future[Seq[org.make.core.proposal.ProposalId]]](akka.stream.scaladsl.Sink.seq[org.make.core.proposal.ProposalId])(stream.this.Materializer.matFromSystem(DefaultUserHistoryCoordinatorServiceComponent.this.actorSystem))
109 10889 4496 - 4504 TypeApply akka.stream.scaladsl.Sink.seq akka.stream.scaladsl.Sink.seq[org.make.core.proposal.ProposalId]
109 14875 4495 - 4495 ApplyToImplicitArgs akka.stream.Materializer.matFromSystem stream.this.Materializer.matFromSystem(DefaultUserHistoryCoordinatorServiceComponent.this.actorSystem)
111 14895 4612 - 4612 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
111 18214 4558 - 4558 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
111 14733 4558 - 4558 Select org.make.api.technical.ActorSystemComponent.actorSystem DefaultUserHistoryCoordinatorServiceComponent.this.actorSystem
111 13677 4578 - 4598 Select org.make.api.userhistory.RequestUserVotedProposals.proposalsIds request.proposalsIds
111 11649 4535 - 4627 ApplyToImplicitArgs scala.concurrent.Future.flatMap org.make.api.technical.BetterLoggingActors.BetterLoggingTypedActorRef[org.make.api.userhistory.UserHistoryCommand](DefaultUserHistoryCoordinatorServiceComponent.this.userHistoryCoordinator).??[org.make.api.userhistory.UserHistoryResponse[Seq[org.make.core.proposal.ProposalId]]](((x$3: akka.actor.typed.ActorRef[org.make.api.userhistory.UserHistoryResponse[Seq[org.make.core.proposal.ProposalId]]]) => requestPaginate(request.proposalsIds, x$3)))(scala.concurrent.ExecutionContext.Implicits.global, DefaultUserHistoryCoordinatorServiceComponent.this.actorSystem, DefaultUserHistoryCoordinatorService.this.timeout).flatMap[Seq[org.make.core.proposal.ProposalId]](((response: org.make.api.userhistory.UserHistoryResponse[Seq[org.make.core.proposal.ProposalId]]) => DefaultUserHistoryCoordinatorService.this.shapeResponse[Seq[org.make.core.proposal.ProposalId]](response)))(scala.concurrent.ExecutionContext.Implicits.global)
111 17675 4535 - 4557 Select org.make.api.userhistory.UserHistoryCoordinatorComponent.userHistoryCoordinator DefaultUserHistoryCoordinatorServiceComponent.this.userHistoryCoordinator
111 11897 4562 - 4602 Apply org.make.api.userhistory.DefaultUserHistoryCoordinatorServiceComponent.DefaultUserHistoryCoordinatorService.requestPaginate requestPaginate(request.proposalsIds, x$3)
111 16646 4613 - 4626 Apply org.make.api.userhistory.DefaultUserHistoryCoordinatorServiceComponent.DefaultUserHistoryCoordinatorService.shapeResponse DefaultUserHistoryCoordinatorService.this.shapeResponse[Seq[org.make.core.proposal.ProposalId]](response)
111 10850 4558 - 4558 Select org.make.api.userhistory.DefaultUserHistoryCoordinatorServiceComponent.DefaultUserHistoryCoordinatorService.timeout DefaultUserHistoryCoordinatorService.this.timeout
117 14003 4796 - 4796 Select scala.concurrent.ExecutionContext.Implicits.global org.make.api.userhistory.userhistorycoordinatortest scala.concurrent.ExecutionContext.Implicits.global
117 17692 4797 - 4835 Apply org.make.api.userhistory.DefaultUserHistoryCoordinatorServiceComponent.DefaultUserHistoryCoordinatorService.retrieveVotedProposalsPage DefaultUserHistoryCoordinatorService.this.retrieveVotedProposalsPage(request, x$4)
118 10435 4856 - 4864 Apply scala.Predef.identity scala.Predef.identity[Seq[org.make.core.proposal.ProposalId]](x)
119 18229 4883 - 4891 TypeApply akka.stream.scaladsl.Sink.seq org.make.api.userhistory.userhistorycoordinatortest akka.stream.scaladsl.Sink.seq[org.make.core.proposal.ProposalId]
119 10866 4882 - 4882 ApplyToImplicitArgs akka.stream.Materializer.matFromSystem org.make.api.userhistory.userhistorycoordinatortest stream.this.Materializer.matFromSystem(DefaultUserHistoryCoordinatorServiceComponent.this.actorSystem)
119 16996 4754 - 4892 ApplyToImplicitArgs akka.stream.scaladsl.Source.runWith org.make.api.userhistory.userhistorycoordinatortest org.make.api.technical.StreamUtils.asyncPageToPageSource[org.make.core.proposal.ProposalId](((x$4: Int) => DefaultUserHistoryCoordinatorService.this.retrieveVotedProposalsPage(request, x$4)))(scala.concurrent.ExecutionContext.Implicits.global).mapConcat[org.make.core.proposal.ProposalId](((x: Seq[org.make.core.proposal.ProposalId]) => scala.Predef.identity[Seq[org.make.core.proposal.ProposalId]](x))).runWith[scala.concurrent.Future[Seq[org.make.core.proposal.ProposalId]]](akka.stream.scaladsl.Sink.seq[org.make.core.proposal.ProposalId])(stream.this.Materializer.matFromSystem(DefaultUserHistoryCoordinatorServiceComponent.this.actorSystem))
119 14624 4882 - 4882 Select org.make.api.technical.ActorSystemComponent.actorSystem org.make.api.userhistory.userhistorycoordinatortest DefaultUserHistoryCoordinatorServiceComponent.this.actorSystem
123 10445 4986 - 4986 Select org.make.api.userhistory.DefaultUserHistoryCoordinatorServiceComponent.DefaultUserHistoryCoordinatorService.timeout org.scalatest.testsuite DefaultUserHistoryCoordinatorService.this.timeout
123 15448 4963 - 4985 Select org.make.api.userhistory.UserHistoryCoordinatorComponent.userHistoryCoordinator org.scalatest.testsuite DefaultUserHistoryCoordinatorServiceComponent.this.userHistoryCoordinator
123 11662 4990 - 5005 Apply org.make.api.userhistory.Stop.apply org.scalatest.testsuite Stop.apply(userId, x$5)
123 17344 4986 - 4986 Select scala.concurrent.ExecutionContext.Implicits.global org.scalatest.testsuite scala.concurrent.ExecutionContext.Implicits.global
123 13899 5008 - 5008 Select scala.concurrent.ExecutionContext.Implicits.global org.scalatest.testsuite scala.concurrent.ExecutionContext.Implicits.global
123 14637 4986 - 4986 Select scala.concurrent.ExecutionContext.Implicits.global org.scalatest.testsuite scala.concurrent.ExecutionContext.Implicits.global
123 10881 4986 - 4986 ApplyToImplicitArgs cats.instances.FutureInstances.catsStdInstancesForFuture org.scalatest.testsuite cats.implicits.catsStdInstancesForFuture(scala.concurrent.ExecutionContext.Implicits.global)
123 13883 4986 - 4986 Select org.make.api.technical.ActorSystemComponent.actorSystem org.scalatest.testsuite DefaultUserHistoryCoordinatorServiceComponent.this.actorSystem
123 10659 5008 - 5008 ApplyToImplicitArgs cats.instances.FutureInstances.catsStdInstancesForFuture org.scalatest.testsuite cats.implicits.catsStdInstancesForFuture(scala.concurrent.ExecutionContext.Implicits.global)
123 17839 4962 - 5087 ApplyToImplicitArgs cats.syntax.FlatMapOps.>> org.scalatest.testsuite cats.implicits.catsSyntaxFlatMapOps[scala.concurrent.Future, org.make.api.userhistory.UserHistoryResponse[Unit]](org.make.api.technical.BetterLoggingActors.BetterLoggingTypedActorRef[org.make.api.userhistory.UserHistoryCommand](DefaultUserHistoryCoordinatorServiceComponent.this.userHistoryCoordinator).??[org.make.api.userhistory.UserHistoryResponse[Unit]](((x$5: akka.actor.typed.ActorRef[org.make.api.userhistory.UserHistoryResponse[Unit]]) => Stop.apply(userId, x$5)))(scala.concurrent.ExecutionContext.Implicits.global, DefaultUserHistoryCoordinatorServiceComponent.this.actorSystem, DefaultUserHistoryCoordinatorService.this.timeout))(cats.implicits.catsStdInstancesForFuture(scala.concurrent.ExecutionContext.Implicits.global)).>>[Unit](org.make.api.technical.MakePersistentActor.delete[org.make.core.user.UserId](userId, UserHistoryActor.JournalPluginId)(scala.concurrent.ExecutionContext.Implicits.global, DefaultUserHistoryCoordinatorServiceComponent.this.actorSystem))(cats.implicits.catsStdInstancesForFuture(scala.concurrent.ExecutionContext.Implicits.global))
123 17821 4963 - 5006 ApplyToImplicitArgs org.make.api.technical.BetterLoggingActors.BetterLoggingTypedActorRef.?? org.scalatest.testsuite org.make.api.technical.BetterLoggingActors.BetterLoggingTypedActorRef[org.make.api.userhistory.UserHistoryCommand](DefaultUserHistoryCoordinatorServiceComponent.this.userHistoryCoordinator).??[org.make.api.userhistory.UserHistoryResponse[Unit]](((x$5: akka.actor.typed.ActorRef[org.make.api.userhistory.UserHistoryResponse[Unit]]) => Stop.apply(userId, x$5)))(scala.concurrent.ExecutionContext.Implicits.global, DefaultUserHistoryCoordinatorServiceComponent.this.actorSystem, DefaultUserHistoryCoordinatorService.this.timeout)
124 16877 5054 - 5086 Select org.make.api.userhistory.UserHistoryActor.JournalPluginId UserHistoryActor.JournalPluginId
124 17358 5019 - 5087 ApplyToImplicitArgs org.make.api.technical.MakePersistentActor.delete org.make.api.technical.MakePersistentActor.delete[org.make.core.user.UserId](userId, UserHistoryActor.JournalPluginId)(scala.concurrent.ExecutionContext.Implicits.global, DefaultUserHistoryCoordinatorServiceComponent.this.actorSystem)
124 13186 5045 - 5045 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
124 11266 5045 - 5045 Select org.make.api.technical.ActorSystemComponent.actorSystem DefaultUserHistoryCoordinatorServiceComponent.this.actorSystem
127 14601 5227 - 5251 Apply scala.concurrent.Future.successful scala.concurrent.Future.successful[T](value)
129 18320 5280 - 5416 Apply scala.concurrent.Future.failed scala.concurrent.Future.failed[Nothing](org.make.core.ValidationFailedError.apply(scala.`package`.Seq.apply[org.make.core.ValidationError](org.make.core.ValidationError.apply("status", "invalid_state", scala.Some.apply[String](other.toString())))))
130 17689 5340 - 5404 Apply org.make.core.ValidationError.apply org.make.core.ValidationError.apply("status", "invalid_state", scala.Some.apply[String](other.toString()))
130 10786 5356 - 5364 Literal <nosymbol> "status"
130 10074 5305 - 5406 Apply org.make.core.ValidationFailedError.apply org.make.core.ValidationFailedError.apply(scala.`package`.Seq.apply[org.make.core.ValidationError](org.make.core.ValidationError.apply("status", "invalid_state", scala.Some.apply[String](other.toString()))))
130 11288 5383 - 5403 Apply scala.Some.apply scala.Some.apply[String](other.toString())
130 13790 5336 - 5405 Apply scala.collection.SeqFactory.Delegate.apply scala.`package`.Seq.apply[org.make.core.ValidationError](org.make.core.ValidationError.apply("status", "invalid_state", scala.Some.apply[String](other.toString())))
130 16894 5366 - 5381 Literal <nosymbol> "invalid_state"
130 13661 5388 - 5402 Apply java.lang.Object.toString other.toString()