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.user
21 
22 import akka.actor.typed.{ActorSystem, Behavior}
23 import akka.util.Timeout
24 import grizzled.slf4j.Logging
25 import org.make.api.technical.KafkaConsumerBehavior.Protocol
26 import org.make.api.technical.crm.SendMailPublisherService
27 import org.make.api.technical.{KafkaConsumerBehavior, TimeSettings}
28 import org.make.api.userhistory._
29 import org.make.core.user.{User, UserId}
30 import org.make.core.user.UserType._
31 
32 import scala.concurrent.ExecutionContext.Implicits.global
33 import scala.concurrent.Future
34 
35 class UserEmailConsumerBehavior(userService: UserService, sendMailPublisherService: SendMailPublisherService)
36     extends KafkaConsumerBehavior[UserEventWrapper]
37     with Logging {
38 
39   override protected val topicKey: String = UserProducerBehavior.topicKey
40   override val groupId = "user-email"
41 
42   implicit val timeout: Timeout = TimeSettings.defaultTimeout
43 
44   override def handleMessage(message: UserEventWrapper)(system: ActorSystem[_]): Future[_] = {
45     message.event match {
46       case event: ResetPasswordEvent              => handleResetPasswordEvent(event)
47       case event: UserRegisteredEvent             => handleUserRegisteredEvent(event)
48       case event: UserValidatedAccountEvent       => handleUserValidatedAccountEvent(event)
49       case event: UserConnectedEvent              => doNothing(event)
50       case event: UserUpdatedTagEvent             => doNothing(event)
51       case event: ResendValidationEmailEvent      => handleResendValidationEmailEvent(event)
52       case event: OrganisationRegisteredEvent     => handleOrganisationRegisteredEvent(event)
53       case event: OrganisationUpdatedEvent        => doNothing(event)
54       case event: OrganisationEmailChangedEvent   => handleOrganisationEmailChangedEvent(event)
55       case event: PersonalityEmailChangedEvent    => handlePersonalityEmailChangedEvent(event)
56       case event: OrganisationInitializationEvent => doNothing(event)
57       case event: UserUpdatedOptInNewsletterEvent => doNothing(event)
58       case event: UserAnonymizedEvent             => doNothing(event)
59       case event: UserFollowEvent                 => doNothing(event)
60       case event: UserUnfollowEvent               => doNothing(event)
61       case event: UserUploadAvatarEvent           => doNothing(event)
62       case event: PersonalityRegisteredEvent      => handlePersonalityRegisteredEvent(event)
63       case event: VoteOnlyEvent                   => handleVoteOnlyEvent(event)
64       case event: VoteOnlyTestEvent               => handleVoteOnlyTestEvent(event)
65     }
66   }
67 
68   def handleResendValidationEmailEvent(event: ResendValidationEmailEvent): Future[Unit] = {
69     getUserWithValidEmail(event.userId).flatMap {
70       case Some(user) =>
71         sendMailPublisherService.resendRegistration(user, event.requestContext)
72       case None => Future.unit
73     }
74   }
75 
76   def handleUserValidatedAccountEvent(event: UserValidatedAccountEvent): Future[Unit] = {
77     getUserWithValidEmail(event.userId).flatMap {
78       case Some(user) if user.isB2C =>
79         sendMailPublisherService.publishWelcome(user, event.requestContext)
80       case _ => Future.unit
81     }
82   }
83 
84   def handleOrganisationRegisteredEvent(event: OrganisationRegisteredEvent): Future[Unit] = {
85     getUserWithValidEmail(event.userId).flatMap {
86       case Some(user) if user.hashedPassword.isEmpty =>
87         sendMailPublisherService.publishRegistrationB2B(user, event.requestContext)
88       case _ => Future.unit
89     }
90   }
91 
92   def handlePersonalityRegisteredEvent(event: PersonalityRegisteredEvent): Future[Unit] = {
93     getUserWithValidEmail(event.userId).flatMap {
94       case Some(user) if user.hashedPassword.isEmpty =>
95         sendMailPublisherService.publishRegistrationB2B(user, event.requestContext)
96       case _ => Future.unit
97     }
98   }
99 
100   def handleUserRegisteredEvent(event: UserRegisteredEvent): Future[Unit] = {
101     getUserWithValidEmail(event.userId).flatMap {
102       case Some(user) if user.isB2C && !event.isSocialLogin =>
103         sendMailPublisherService.publishRegistration(user, event.requestContext)
104       case _ => Future.unit
105     }
106   }
107 
108   private def handleResetPasswordEvent(event: ResetPasswordEvent): Future[Unit] = {
109     getUserWithValidEmail(event.userId).flatMap {
110       case Some(user) if user.isB2B =>
111         sendMailPublisherService.publishForgottenPasswordOrganisation(user, event.requestContext)
112       case Some(user) =>
113         sendMailPublisherService.publishForgottenPassword(user, event.requestContext)
114       case None => Future.unit
115     }
116   }
117 
118   private def handleOrganisationEmailChangedEvent(event: OrganisationEmailChangedEvent): Future[Unit] = {
119     getUserWithValidEmail(event.userId).flatMap {
120       case Some(organisation) =>
121         sendMailPublisherService.publishEmailChanged(
122           user = organisation,
123           requestContext = event.requestContext,
124           newEmail = event.newEmail
125         )
126       case None => Future.unit
127     }
128   }
129 
130   private def handlePersonalityEmailChangedEvent(event: PersonalityEmailChangedEvent): Future[Unit] = {
131     getUserWithValidEmail(event.userId).flatMap {
132       case Some(personality) =>
133         sendMailPublisherService.publishEmailChanged(
134           user = personality,
135           requestContext = event.requestContext,
136           newEmail = event.newEmail
137         )
138       case None => Future.unit
139     }
140   }
141 
142   private def handleVoteOnlyEvent(event: VoteOnlyEvent): Future[Unit] =
143     sendMailPublisherService.sendVoteOnlyNotice(event.requestContext).recover(logger.error(_))
144 
145   private def handleVoteOnlyTestEvent(event: VoteOnlyTestEvent): Future[Unit] =
146     sendMailPublisherService.sendVoteOnlyTest(event.userId, event.requestContext).recover(logger.error(_))
147 
148   private def getUserWithValidEmail(userId: UserId): Future[Option[User]] = {
149     userService.getUser(userId).map {
150       case Some(user) if user.isHardBounce =>
151         info(s"a hardbounced user (${user.userId}) will be ignored by email consumer")
152         None
153       case Some(user) => Some(user)
154       case None =>
155         warn(s"can't find user with id $userId")
156         None
157     }
158   }
159 }
160 
161 object UserEmailConsumerBehavior {
162   def apply(userService: UserService, sendMailPublisherService: SendMailPublisherService): Behavior[Protocol] =
163     new UserEmailConsumerBehavior(userService, sendMailPublisherService).createBehavior(name)
164   val name: String = "user-consumer"
165 }
Line Stmt Id Pos Tree Symbol Tests Code
39 6634 1492 - 1521 Select org.make.api.user.UserProducerBehavior.topicKey UserProducerBehavior.topicKey
40 5824 1547 - 1559 Literal <nosymbol> "user-email"
42 7664 1595 - 1622 Select org.make.api.technical.TimeSettings.defaultTimeout org.make.api.technical.TimeSettings.defaultTimeout
45 6892 1723 - 1736 Select org.make.api.userhistory.UserEventWrapper.event message.event
46 6030 1798 - 1829 Apply org.make.api.user.UserEmailConsumerBehavior.handleResetPasswordEvent UserEmailConsumerBehavior.this.handleResetPasswordEvent(event)
47 7335 1883 - 1915 Apply org.make.api.user.UserEmailConsumerBehavior.handleUserRegisteredEvent UserEmailConsumerBehavior.this.handleUserRegisteredEvent(event)
48 6981 1969 - 2007 Apply org.make.api.user.UserEmailConsumerBehavior.handleUserValidatedAccountEvent UserEmailConsumerBehavior.this.handleUserValidatedAccountEvent(event)
49 6150 2061 - 2077 Apply org.make.api.technical.KafkaConsumerBehavior.doNothing UserEmailConsumerBehavior.this.doNothing(event)
50 7528 2131 - 2147 Apply org.make.api.technical.KafkaConsumerBehavior.doNothing UserEmailConsumerBehavior.this.doNothing(event)
51 6712 2201 - 2240 Apply org.make.api.user.UserEmailConsumerBehavior.handleResendValidationEmailEvent UserEmailConsumerBehavior.this.handleResendValidationEmailEvent(event)
52 5852 2294 - 2334 Apply org.make.api.user.UserEmailConsumerBehavior.handleOrganisationRegisteredEvent UserEmailConsumerBehavior.this.handleOrganisationRegisteredEvent(event)
53 7672 2388 - 2404 Apply org.make.api.technical.KafkaConsumerBehavior.doNothing UserEmailConsumerBehavior.this.doNothing(event)
54 6815 2458 - 2500 Apply org.make.api.user.UserEmailConsumerBehavior.handleOrganisationEmailChangedEvent UserEmailConsumerBehavior.this.handleOrganisationEmailChangedEvent(event)
55 6007 2554 - 2595 Apply org.make.api.user.UserEmailConsumerBehavior.handlePersonalityEmailChangedEvent UserEmailConsumerBehavior.this.handlePersonalityEmailChangedEvent(event)
56 7389 2649 - 2665 Apply org.make.api.technical.KafkaConsumerBehavior.doNothing UserEmailConsumerBehavior.this.doNothing(event)
57 6958 2719 - 2735 Apply org.make.api.technical.KafkaConsumerBehavior.doNothing UserEmailConsumerBehavior.this.doNothing(event)
58 6156 2789 - 2805 Apply org.make.api.technical.KafkaConsumerBehavior.doNothing UserEmailConsumerBehavior.this.doNothing(event)
59 7531 2859 - 2875 Apply org.make.api.technical.KafkaConsumerBehavior.doNothing UserEmailConsumerBehavior.this.doNothing(event)
60 6698 2929 - 2945 Apply org.make.api.technical.KafkaConsumerBehavior.doNothing UserEmailConsumerBehavior.this.doNothing(event)
61 5822 2999 - 3015 Apply org.make.api.technical.KafkaConsumerBehavior.doNothing UserEmailConsumerBehavior.this.doNothing(event)
62 7679 3069 - 3108 Apply org.make.api.user.UserEmailConsumerBehavior.handlePersonalityRegisteredEvent UserEmailConsumerBehavior.this.handlePersonalityRegisteredEvent(event)
63 6786 3162 - 3188 Apply org.make.api.user.UserEmailConsumerBehavior.handleVoteOnlyEvent UserEmailConsumerBehavior.this.handleVoteOnlyEvent(event)
64 6011 3242 - 3272 Apply org.make.api.user.UserEmailConsumerBehavior.handleVoteOnlyTestEvent UserEmailConsumerBehavior.this.handleVoteOnlyTestEvent(event)
69 6701 3424 - 3424 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
69 7331 3402 - 3414 Select org.make.api.userhistory.ResendValidationEmailEvent.userId event.userId
69 5796 3380 - 3567 ApplyToImplicitArgs scala.concurrent.Future.flatMap UserEmailConsumerBehavior.this.getUserWithValidEmail(event.userId).flatMap[Unit](((x0$1: Option[org.make.core.user.User]) => x0$1 match { case (value: org.make.core.user.User): Some[org.make.core.user.User]((user @ _)) => UserEmailConsumerBehavior.this.sendMailPublisherService.resendRegistration(user, event.requestContext) case scala.None => scala.concurrent.Future.unit }))(scala.concurrent.ExecutionContext.Implicits.global)
71 6503 3509 - 3529 Select org.make.api.userhistory.ResendValidationEmailEvent.requestContext event.requestContext
71 6165 3459 - 3530 Apply org.make.api.technical.crm.SendMailPublisherService.resendRegistration UserEmailConsumerBehavior.this.sendMailPublisherService.resendRegistration(user, event.requestContext)
72 7496 3550 - 3561 Select scala.concurrent.Future.unit scala.concurrent.Future.unit
77 6740 3667 - 3861 ApplyToImplicitArgs scala.concurrent.Future.flatMap UserEmailConsumerBehavior.this.getUserWithValidEmail(event.userId).flatMap[Unit](((x0$1: Option[org.make.core.user.User]) => x0$1 match { case (value: org.make.core.user.User): Some[org.make.core.user.User]((user @ _)) if org.make.core.user.UserType.UserTypeOps[org.make.core.user.User](user).isB2C(user.this.HasUserType.userUserType) => UserEmailConsumerBehavior.this.sendMailPublisherService.publishWelcome(user, event.requestContext) case _ => scala.concurrent.Future.unit }))(scala.concurrent.ExecutionContext.Implicits.global)
77 7502 3711 - 3711 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
77 7605 3689 - 3701 Select org.make.api.userhistory.UserValidatedAccountEvent.userId event.userId
78 6788 3743 - 3743 Select org.make.core.user.HasUserType.userUserType user.this.HasUserType.userUserType
78 5980 3738 - 3748 ApplyToImplicitArgs org.make.core.user.UserType.UserTypeOps.isB2C org.make.core.user.UserType.UserTypeOps[org.make.core.user.User](user).isB2C(user.this.HasUserType.userUserType)
79 6504 3760 - 3827 Apply org.make.api.technical.crm.SendMailPublisherService.publishWelcome UserEmailConsumerBehavior.this.sendMailPublisherService.publishWelcome(user, event.requestContext)
79 7334 3806 - 3826 Select org.make.api.userhistory.UserValidatedAccountEvent.requestContext event.requestContext
80 6148 3844 - 3855 Select scala.concurrent.Future.unit scala.concurrent.Future.unit
85 5800 3987 - 3999 Select org.make.api.userhistory.OrganisationRegisteredEvent.userId event.userId
85 6155 3965 - 4184 ApplyToImplicitArgs scala.concurrent.Future.flatMap UserEmailConsumerBehavior.this.getUserWithValidEmail(event.userId).flatMap[Unit](((x0$1: Option[org.make.core.user.User]) => x0$1 match { case (value: org.make.core.user.User): Some[org.make.core.user.User]((user @ _)) if user.hashedPassword.isEmpty => UserEmailConsumerBehavior.this.sendMailPublisherService.publishRegistrationB2B(user, event.requestContext) case _ => scala.concurrent.Future.unit }))(scala.concurrent.ExecutionContext.Implicits.global)
85 6490 4009 - 4009 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
86 7198 4036 - 4063 Select scala.Option.isEmpty user.hashedPassword.isEmpty
87 5983 4075 - 4150 Apply org.make.api.technical.crm.SendMailPublisherService.publishRegistrationB2B UserEmailConsumerBehavior.this.sendMailPublisherService.publishRegistrationB2B(user, event.requestContext)
87 6861 4129 - 4149 Select org.make.api.userhistory.OrganisationRegisteredEvent.requestContext event.requestContext
88 7429 4167 - 4178 Select scala.concurrent.Future.unit scala.concurrent.Future.unit
93 7566 4308 - 4320 Select org.make.api.userhistory.PersonalityRegisteredEvent.userId event.userId
93 7432 4286 - 4505 ApplyToImplicitArgs scala.concurrent.Future.flatMap UserEmailConsumerBehavior.this.getUserWithValidEmail(event.userId).flatMap[Unit](((x0$1: Option[org.make.core.user.User]) => x0$1 match { case (value: org.make.core.user.User): Some[org.make.core.user.User]((user @ _)) if user.hashedPassword.isEmpty => UserEmailConsumerBehavior.this.sendMailPublisherService.publishRegistrationB2B(user, event.requestContext) case _ => scala.concurrent.Future.unit }))(scala.concurrent.ExecutionContext.Implicits.global)
93 5972 4330 - 4330 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
94 6743 4357 - 4384 Select scala.Option.isEmpty user.hashedPassword.isEmpty
95 5805 4450 - 4470 Select org.make.api.userhistory.PersonalityRegisteredEvent.requestContext event.requestContext
95 7267 4396 - 4471 Apply org.make.api.technical.crm.SendMailPublisherService.publishRegistrationB2B UserEmailConsumerBehavior.this.sendMailPublisherService.publishRegistrationB2B(user, event.requestContext)
96 6868 4488 - 4499 Select scala.concurrent.Future.unit scala.concurrent.Future.unit
101 5978 4637 - 4637 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
101 6495 4615 - 4627 Select org.make.api.userhistory.UserRegisteredEvent.userId event.userId
101 7379 4593 - 4816 ApplyToImplicitArgs scala.concurrent.Future.flatMap UserEmailConsumerBehavior.this.getUserWithValidEmail(event.userId).flatMap[Unit](((x0$1: Option[org.make.core.user.User]) => x0$1 match { case (value: org.make.core.user.User): Some[org.make.core.user.User]((user @ _)) if org.make.core.user.UserType.UserTypeOps[org.make.core.user.User](user).isB2C(user.this.HasUserType.userUserType).&&(event.isSocialLogin.unary_!) => UserEmailConsumerBehavior.this.sendMailPublisherService.publishRegistration(user, event.requestContext) case _ => scala.concurrent.Future.unit }))(scala.concurrent.ExecutionContext.Implicits.global)
102 7571 4678 - 4698 Select scala.Boolean.unary_! event.isSocialLogin.unary_!
102 6110 4669 - 4669 Select org.make.core.user.HasUserType.userUserType user.this.HasUserType.userUserType
102 6699 4664 - 4698 Apply scala.Boolean.&& org.make.core.user.UserType.UserTypeOps[org.make.core.user.User](user).isB2C(user.this.HasUserType.userUserType).&&(event.isSocialLogin.unary_!)
103 5905 4761 - 4781 Select org.make.api.userhistory.UserRegisteredEvent.requestContext event.requestContext
103 7273 4710 - 4782 Apply org.make.api.technical.crm.SendMailPublisherService.publishRegistration UserEmailConsumerBehavior.this.sendMailPublisherService.publishRegistration(user, event.requestContext)
104 6822 4799 - 4810 Select scala.concurrent.Future.unit scala.concurrent.Future.unit
109 6489 4910 - 5240 ApplyToImplicitArgs scala.concurrent.Future.flatMap UserEmailConsumerBehavior.this.getUserWithValidEmail(event.userId).flatMap[Unit](((x0$1: Option[org.make.core.user.User]) => x0$1 match { case (value: org.make.core.user.User): Some[org.make.core.user.User]((user @ _)) if org.make.core.user.UserType.UserTypeOps[org.make.core.user.User](user).isB2B(user.this.HasUserType.userUserType) => UserEmailConsumerBehavior.this.sendMailPublisherService.publishForgottenPasswordOrganisation(user, event.requestContext) case (value: org.make.core.user.User): Some[org.make.core.user.User]((user @ _)) => UserEmailConsumerBehavior.this.sendMailPublisherService.publishForgottenPassword(user, event.requestContext) case scala.None => scala.concurrent.Future.unit }))(scala.concurrent.ExecutionContext.Implicits.global)
109 7367 4954 - 4954 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
109 6527 4932 - 4944 Select org.make.api.userhistory.ResetPasswordEvent.userId event.userId
110 7467 4981 - 4991 ApplyToImplicitArgs org.make.core.user.UserType.UserTypeOps.isB2B org.make.core.user.UserType.UserTypeOps[org.make.core.user.User](user).isB2B(user.this.HasUserType.userUserType)
110 5757 4986 - 4986 Select org.make.core.user.HasUserType.userUserType user.this.HasUserType.userUserType
111 6676 5071 - 5091 Select org.make.api.userhistory.ResetPasswordEvent.requestContext event.requestContext
111 5835 5003 - 5092 Apply org.make.api.technical.crm.SendMailPublisherService.publishForgottenPasswordOrganisation UserEmailConsumerBehavior.this.sendMailPublisherService.publishForgottenPasswordOrganisation(user, event.requestContext)
113 6832 5126 - 5203 Apply org.make.api.technical.crm.SendMailPublisherService.publishForgottenPassword UserEmailConsumerBehavior.this.sendMailPublisherService.publishForgottenPassword(user, event.requestContext)
113 7235 5182 - 5202 Select org.make.api.userhistory.ResetPasswordEvent.requestContext event.requestContext
114 5982 5223 - 5234 Select scala.concurrent.Future.unit scala.concurrent.Future.unit
119 6839 5400 - 5400 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
119 5943 5356 - 5651 ApplyToImplicitArgs scala.concurrent.Future.flatMap UserEmailConsumerBehavior.this.getUserWithValidEmail(event.userId).flatMap[Unit](((x0$1: Option[org.make.core.user.User]) => x0$1 match { case (value: org.make.core.user.User): Some[org.make.core.user.User]((organisation @ _)) => UserEmailConsumerBehavior.this.sendMailPublisherService.publishEmailChanged(organisation, event.requestContext, event.newEmail) case scala.None => scala.concurrent.Future.unit }))(scala.concurrent.ExecutionContext.Implicits.global)
119 5721 5378 - 5390 Select org.make.api.userhistory.OrganisationEmailChangedEvent.userId event.userId
121 5900 5443 - 5614 Apply org.make.api.technical.crm.SendMailPublisherService.publishEmailChanged UserEmailConsumerBehavior.this.sendMailPublisherService.publishEmailChanged(organisation, event.requestContext, event.newEmail)
123 7470 5547 - 5567 Select org.make.api.userhistory.OrganisationEmailChangedEvent.requestContext event.requestContext
124 6680 5590 - 5604 Select org.make.api.userhistory.OrganisationEmailChangedEvent.newEmail event.newEmail
126 7185 5634 - 5645 Select scala.concurrent.Future.unit scala.concurrent.Future.unit
131 7304 5765 - 6058 ApplyToImplicitArgs scala.concurrent.Future.flatMap UserEmailConsumerBehavior.this.getUserWithValidEmail(event.userId).flatMap[Unit](((x0$1: Option[org.make.core.user.User]) => x0$1 match { case (value: org.make.core.user.User): Some[org.make.core.user.User]((personality @ _)) => UserEmailConsumerBehavior.this.sendMailPublisherService.publishEmailChanged(personality, event.requestContext, event.newEmail) case scala.None => scala.concurrent.Future.unit }))(scala.concurrent.ExecutionContext.Implicits.global)
131 7369 5787 - 5799 Select org.make.api.userhistory.PersonalityEmailChangedEvent.userId event.userId
131 5903 5809 - 5809 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
133 7473 5851 - 6021 Apply org.make.api.technical.crm.SendMailPublisherService.publishEmailChanged UserEmailConsumerBehavior.this.sendMailPublisherService.publishEmailChanged(personality, event.requestContext, event.newEmail)
135 6599 5954 - 5974 Select org.make.api.userhistory.PersonalityEmailChangedEvent.requestContext event.requestContext
136 5649 5997 - 6011 Select org.make.api.userhistory.PersonalityEmailChangedEvent.newEmail event.newEmail
138 6644 6041 - 6052 Select scala.concurrent.Future.unit scala.concurrent.Future.unit
143 7401 6226 - 6226 Apply org.make.api.user.UserEmailConsumerBehavior.$anonfun.<init> new $anonfun()
143 5651 6140 - 6230 ApplyToImplicitArgs scala.concurrent.Future.recover UserEmailConsumerBehavior.this.sendMailPublisherService.sendVoteOnlyNotice(event.requestContext).recover[Unit](({ @SerialVersionUID(value = 0) final <synthetic> class $anonfun extends scala.runtime.AbstractPartialFunction[Throwable,Unit] with java.io.Serializable { def <init>(): <$anon: Throwable => Unit> = { $anonfun.super.<init>(); () }; final override def applyOrElse[A1 <: Throwable, B1 >: Unit](x$1: A1, default: A1 => B1): B1 = ((x$1.asInstanceOf[Throwable]: Throwable): Throwable @unchecked) match { case (defaultCase$ @ _) => UserEmailConsumerBehavior.this.logger.error(x$1) case (defaultCase$ @ _) => default.apply(x$1) }; final def isDefinedAt(x$1: Throwable): Boolean = ((x$1.asInstanceOf[Throwable]: Throwable): Throwable @unchecked) match { case (defaultCase$ @ _) => true case (defaultCase$ @ _) => false } }; new $anonfun() }: PartialFunction[Throwable,Unit]))(scala.concurrent.ExecutionContext.Implicits.global)
143 6602 6213 - 6213 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
143 6461 6184 - 6204 Select org.make.api.userhistory.VoteOnlyEvent.requestContext event.requestContext
143 5948 6214 - 6229 Apply grizzled.slf4j.Logger.error UserEmailConsumerBehavior.this.logger.error(x$1)
146 5861 6402 - 6417 Apply grizzled.slf4j.Logger.error UserEmailConsumerBehavior.this.logger.error(x$2)
146 7307 6414 - 6414 Apply org.make.api.user.UserEmailConsumerBehavior.$anonfun.<init> new $anonfun()
146 7537 6358 - 6370 Select org.make.api.userhistory.VoteOnlyTestEvent.userId event.userId
146 6652 6372 - 6392 Select org.make.api.userhistory.VoteOnlyTestEvent.requestContext event.requestContext
146 6015 6316 - 6418 ApplyToImplicitArgs scala.concurrent.Future.recover UserEmailConsumerBehavior.this.sendMailPublisherService.sendVoteOnlyTest(event.userId, event.requestContext).recover[Unit](({ @SerialVersionUID(value = 0) final <synthetic> class $anonfun extends scala.runtime.AbstractPartialFunction[Throwable,Unit] with java.io.Serializable { def <init>(): <$anon: Throwable => Unit> = { $anonfun.super.<init>(); () }; final override def applyOrElse[A1 <: Throwable, B1 >: Unit](x$2: A1, default: A1 => B1): B1 = ((x$2.asInstanceOf[Throwable]: Throwable): Throwable @unchecked) match { case (defaultCase$ @ _) => UserEmailConsumerBehavior.this.logger.error(x$2) case (defaultCase$ @ _) => default.apply(x$2) }; final def isDefinedAt(x$2: Throwable): Boolean = ((x$2.asInstanceOf[Throwable]: Throwable): Throwable @unchecked) match { case (defaultCase$ @ _) => true case (defaultCase$ @ _) => false } }; new $anonfun() }: PartialFunction[Throwable,Unit]))(scala.concurrent.ExecutionContext.Implicits.global)
146 6463 6401 - 6401 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
149 6432 6502 - 6804 ApplyToImplicitArgs scala.concurrent.Future.map UserEmailConsumerBehavior.this.userService.getUser(userId).map[Option[org.make.core.user.User]](((x0$1: Option[org.make.core.user.User]) => x0$1 match { case (value: org.make.core.user.User): Some[org.make.core.user.User]((user @ _)) if user.isHardBounce => { UserEmailConsumerBehavior.this.info(("a hardbounced user (".+(user.userId).+(") will be ignored by email consumer"): String)); scala.None } case (value: org.make.core.user.User): Some[org.make.core.user.User]((user @ _)) => scala.Some.apply[org.make.core.user.User](user) case scala.None => { UserEmailConsumerBehavior.this.warn(("can\'t find user with id ".+(userId): String)); scala.None } }))(scala.concurrent.ExecutionContext.Implicits.global)
149 7311 6534 - 6534 Select scala.concurrent.ExecutionContext.Implicits.global scala.concurrent.ExecutionContext.Implicits.global
150 7403 6561 - 6578 Select org.make.core.user.User.isHardBounce user.isHardBounce
151 6566 6590 - 6668 Apply grizzled.slf4j.Logging.info UserEmailConsumerBehavior.this.info(("a hardbounced user (".+(user.userId).+(") will be ignored by email consumer"): String))
152 5719 6677 - 6681 Select scala.None scala.None
153 7164 6707 - 6717 Apply scala.Some.apply scala.Some.apply[org.make.core.user.User](user)
155 6638 6745 - 6785 Apply grizzled.slf4j.Logging.warn UserEmailConsumerBehavior.this.warn(("can\'t find user with id ".+(userId): String))
156 5864 6794 - 6798 Select scala.None scala.None
163 6022 7047 - 7051 Select org.make.api.user.UserEmailConsumerBehavior.name UserEmailConsumerBehavior.this.name
163 7339 6963 - 7052 Apply org.make.api.technical.KafkaConsumerBehavior.createBehavior new UserEmailConsumerBehavior(userService, sendMailPublisherService).createBehavior(UserEmailConsumerBehavior.this.name)
164 6569 7074 - 7089 Literal <nosymbol> "user-consumer"