Skip to content

Commit

Permalink
TRELLO-2537: Prevent from sending emails on sample data creation
Browse files Browse the repository at this point in the history
  • Loading branch information
ssedoudbgouv committed Sep 28, 2024
1 parent 13af19b commit 23cf168
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 27 deletions.
15 changes: 11 additions & 4 deletions app/loader/SignalConsoApplicationLoader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,10 @@ import repositories.website.WebsiteRepositoryInterface
import services._
import services.antivirus.AntivirusService
import services.antivirus.AntivirusServiceInterface
import services.emails.BaseEmail
import services.emails.MailRetriesService
import services.emails.MailService
import services.emails.MailServiceInterface
import slick.basic.DatabaseConfig
import slick.jdbc.JdbcProfile
import sttp.capabilities
Expand Down Expand Up @@ -273,7 +275,7 @@ class SignalConsoComponents(
implicit val frontRoute: FrontRoute = new FrontRoute(signalConsoConfiguration)
val attachmentService = new AttachmentService(environment, pdfService, frontRoute)
lazy val mailRetriesService = new MailRetriesService(mailerClient, executionContext, actorSystem)
val mailService = new MailService(
var mailService = new MailService(
mailRetriesService,
emailConfiguration,
reportNotificationBlockedRepository,
Expand Down Expand Up @@ -387,8 +389,9 @@ class SignalConsoComponents(
)

val emailNotificationOrchestrator = new EmailNotificationOrchestrator(mailService, subscriptionRepository)
val reportOrchestrator = new ReportOrchestrator(
mailService,

def buildReportOrchestrator(emailService: MailServiceInterface) = new ReportOrchestrator(
emailService,
reportConsumerReviewOrchestrator,
reportRepository,
reportMetadataRepository,
Expand All @@ -412,6 +415,8 @@ class SignalConsoComponents(
messagesApi
)

val reportOrchestrator = buildReportOrchestrator(mailService)

val reportAssignmentOrchestrator = new ReportAssignmentOrchestrator(
reportOrchestrator,
companiesVisibilityOrchestrator,
Expand Down Expand Up @@ -555,11 +560,13 @@ class SignalConsoComponents(
taskRepository
)

private val reportOrchestratorWithFakeMailer = buildReportOrchestrator(_ => Future.unit)

val sampleDataService = new SampleDataService(
companyRepository,
userRepository,
accessTokenRepository,
reportOrchestrator,
reportOrchestratorWithFakeMailer,
reportRepository,
companyAccessRepository,
reportAdminActionOrchestrator,
Expand Down
46 changes: 23 additions & 23 deletions app/orchestrators/ReportOrchestrator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import services.emails.EmailDefinitionsConsumer.ConsumerReportAcknowledgment
import services.emails.EmailDefinitionsConsumer.ConsumerReportReadByProNotification
import services.emails.EmailDefinitionsPro.ProNewReportNotification
import services.emails.EmailDefinitionsPro.ProResponseAcknowledgment
import services.emails.MailService
import services.emails.MailServiceInterface
import tasks.company.CompanySyncServiceInterface
import utils.Constants.ActionEvent._
import utils.Constants.ActionEvent
Expand All @@ -67,28 +67,28 @@ import scala.concurrent.duration._
import scala.util.Random

class ReportOrchestrator(
mailService: MailService,
reportConsumerReviewOrchestrator: ReportConsumerReviewOrchestrator,
reportRepository: ReportRepositoryInterface,
reportMetadataRepository: ReportMetadataRepositoryInterface,
reportFileOrchestrator: ReportFileOrchestrator,
companyRepository: CompanyRepositoryInterface,
socialNetworkRepository: SocialNetworkRepositoryInterface,
accessTokenRepository: AccessTokenRepositoryInterface,
eventRepository: EventRepositoryInterface,
userRepository: UserRepositoryInterface,
websiteRepository: WebsiteRepositoryInterface,
companiesVisibilityOrchestrator: CompaniesVisibilityOrchestrator,
emailNotificationOrchestrator: EmailNotificationOrchestrator,
blacklistedEmailsRepository: BlacklistedEmailsRepositoryInterface,
emailValidationOrchestrator: EmailValidationOrchestrator,
emailConfiguration: EmailConfiguration,
tokenConfiguration: TokenConfiguration,
signalConsoConfiguration: SignalConsoConfiguration,
companySyncService: CompanySyncServiceInterface,
engagementRepository: EngagementRepositoryInterface,
engagementOrchestrator: EngagementOrchestrator,
messagesApi: MessagesApi
mailService: MailServiceInterface,
reportConsumerReviewOrchestrator: ReportConsumerReviewOrchestrator,
reportRepository: ReportRepositoryInterface,
reportMetadataRepository: ReportMetadataRepositoryInterface,
reportFileOrchestrator: ReportFileOrchestrator,
companyRepository: CompanyRepositoryInterface,
socialNetworkRepository: SocialNetworkRepositoryInterface,
accessTokenRepository: AccessTokenRepositoryInterface,
eventRepository: EventRepositoryInterface,
userRepository: UserRepositoryInterface,
websiteRepository: WebsiteRepositoryInterface,
companiesVisibilityOrchestrator: CompaniesVisibilityOrchestrator,
emailNotificationOrchestrator: EmailNotificationOrchestrator,
blacklistedEmailsRepository: BlacklistedEmailsRepositoryInterface,
emailValidationOrchestrator: EmailValidationOrchestrator,
emailConfiguration: EmailConfiguration,
tokenConfiguration: TokenConfiguration,
signalConsoConfiguration: SignalConsoConfiguration,
companySyncService: CompanySyncServiceInterface,
engagementRepository: EngagementRepositoryInterface,
engagementOrchestrator: EngagementOrchestrator,
messagesApi: MessagesApi
)(implicit val executionContext: ExecutionContext) {
val logger = Logger(this.getClass)

Expand Down

0 comments on commit 23cf168

Please sign in to comment.