diff --git a/apps/worker/src/app/workflow/usecases/send-message/send-message-email.usecase.ts b/apps/worker/src/app/workflow/usecases/send-message/send-message-email.usecase.ts index 7d01514aab4..2bb60121171 100644 --- a/apps/worker/src/app/workflow/usecases/send-message/send-message-email.usecase.ts +++ b/apps/worker/src/app/workflow/usecases/send-message/send-message-email.usecase.ts @@ -53,7 +53,6 @@ export class SendMessageEmail extends SendMessageBase { constructor( protected environmentRepository: EnvironmentRepository, - protected organizationRepository: OrganizationRepository, protected subscriberRepository: SubscriberRepository, protected messageRepository: MessageRepository, protected layoutRepository: LayoutRepository, @@ -212,12 +211,10 @@ export class SendMessageEmail extends SendMessageBase { } try { - const organization = await this.getOrganization(command.organizationId); - const i18nInstance = await this.initiateTranslations( command.environmentId, command.organizationId, - command.payload.subscriber?.locale || organization?.defaultLocale + subscriber.locale ); if (!command.bridgeData) { @@ -548,16 +545,6 @@ export class SendMessageEmail extends SendMessageBase { } } - protected async getOrganization(organizationId: string): Promise { - const organization = await this.organizationRepository.findById(organizationId, 'branding defaultLocale'); - - if (!organization) { - throw new NotFoundException(`Organization ${organizationId} not found`); - } - - return organization; - } - public buildFactoryIntegration(integration: IntegrationEntity, senderName?: string) { return { ...integration, diff --git a/apps/worker/src/app/workflow/usecases/send-message/send-message-in-app.usecase.ts b/apps/worker/src/app/workflow/usecases/send-message/send-message-in-app.usecase.ts index 06e75c3ef14..ff80d683928 100644 --- a/apps/worker/src/app/workflow/usecases/send-message/send-message-in-app.usecase.ts +++ b/apps/worker/src/app/workflow/usecases/send-message/send-message-in-app.usecase.ts @@ -45,7 +45,6 @@ export class SendMessageInApp extends SendMessageBase { constructor( private invalidateCache: InvalidateCacheService, protected messageRepository: MessageRepository, - protected organizationRepository: OrganizationRepository, private webSocketsQueueService: WebSocketsQueueService, protected createLogUsecase: CreateLog, protected executionLogRoute: ExecutionLogRoute, @@ -108,6 +107,7 @@ export class SendMessageInApp extends SendMessageBase { const { actor } = command.step.template; + const { subscriber } = command.compileContext; const template = await this.processVariants(command); if (template) { @@ -116,12 +116,10 @@ export class SendMessageInApp extends SendMessageBase { try { if (!command.bridgeData) { - const organization = await this.getOrganization(command.organizationId); - const i18nInstance = await this.initiateTranslations( command.environmentId, command.organizationId, - command.payload.subscriber?.locale || organization?.defaultLocale + subscriber.locale ); const compiled = await this.compileInAppTemplate.execute( @@ -271,14 +269,4 @@ export class SendMessageInApp extends SendMessageBase { }) ); } - - protected async getOrganization(organizationId: string): Promise { - const organization = await this.organizationRepository.findById(organizationId, 'branding defaultLocale'); - - if (!organization) { - throw new NotFoundException(`Organization ${organizationId} not found`); - } - - return organization; - } }