diff --git a/app/Domains/Notification/Services/NotificationMailService.php b/app/Domains/Notification/Services/NotificationMailService.php index dba369f..fccd708 100644 --- a/app/Domains/Notification/Services/NotificationMailService.php +++ b/app/Domains/Notification/Services/NotificationMailService.php @@ -23,14 +23,15 @@ class NotificationMailService { $tenant = Tenant::query()->with('websiteType')->where('codigo', $tenantCode)->firstOrFail(); $user = User::query()->findOrFail($userId); + $brand = $tenant->websiteType ?? $tenant; $this->mailService ->forTenant($tenantCode) ->send( $user->email, - "Bienvenido a {$tenant->nombre}", - view('mail.notifications.welcome', compact('tenant', 'user'))->render(), - $tenant->websiteType ?? $tenant, + "Bienvenido a {$brand->nombre}", + view('mail.notifications.welcome', compact('brand', 'user'))->render(), + $brand, ); } @@ -76,19 +77,19 @@ class NotificationMailService $recoveryUrl = $recoveryDomain === null ? null : 'https://'.$recoveryDomain.$recoveryBasePath.'/recuperar-contrasena/codigo?'.http_build_query($recoveryQuery); + $brand = $tenant->websiteType ?? $tenant; $this->mailService ->forTenant($tenantCode) ->send( $attempt->user->email, - "Código para recuperar tu contraseña - {$tenant->nombre}", + "Código para recuperar tu contraseña - {$brand->nombre}", view('mail.notifications.password-reset', [ - 'tenant' => $tenant, 'attempt' => $attempt, 'recoveryUrl' => $recoveryUrl, - 'brand' => $tenant->websiteType ?? $tenant, + 'brand' => $brand, ])->render(), - $tenant->websiteType ?? $tenant, + $brand, ); } diff --git a/resources/views/mail/notifications/password-reset.blade.php b/resources/views/mail/notifications/password-reset.blade.php index 4fd19a9..2cc4aab 100644 --- a/resources/views/mail/notifications/password-reset.blade.php +++ b/resources/views/mail/notifications/password-reset.blade.php @@ -4,7 +4,7 @@ @if($attempt->reason === \App\Domains\Auth\Models\ResetPasswordAttempt::REASON_STAFF_CREATED)

- Hola {{ $attempt->user->nombre_apellido }}, creamos tu cuenta de scanner en {{ $tenant->nombre }}. Utilizá este código para crear tu contraseña y comenzar a usarla. + Hola {{ $attempt->user->nombre_apellido }}, creamos tu cuenta de scanner en {{ $brand->nombre }}. Utilizá este código para crear tu contraseña y comenzar a usarla.

@elseif($attempt->reason === \App\Domains\Auth\Models\ResetPasswordAttempt::REASON_ACCOUNT_LOCKED)

@@ -17,7 +17,7 @@

@endif -

Ingresá este código en {{ $tenant->nombre }}:

+

Ingresá este código en {{ $brand->nombre }}:

diff --git a/resources/views/mail/notifications/welcome.blade.php b/resources/views/mail/notifications/welcome.blade.php index aa541a6..5f0e215 100644 --- a/resources/views/mail/notifications/welcome.blade.php +++ b/resources/views/mail/notifications/welcome.blade.php @@ -1,3 +1,3 @@ -

¡Bienvenido a {{ $tenant->nombre }}!

+

¡Bienvenido a {{ $brand->nombre }}!

Hola {{ $user->nombre_apellido }}, tu cuenta fue creada correctamente.

Ya podés ingresar y comenzar a comprar.

diff --git a/tests/Feature/Notification/NotificationMailServiceTest.php b/tests/Feature/Notification/NotificationMailServiceTest.php index 348aa45..1f02278 100644 --- a/tests/Feature/Notification/NotificationMailServiceTest.php +++ b/tests/Feature/Notification/NotificationMailServiceTest.php @@ -77,11 +77,11 @@ class NotificationMailServiceTest extends TestCase Mail::assertSent(Mailable::class, function (Mailable $mail): bool { $mail->assertTo('ada@example.com'); - $mail->assertHasSubject('Bienvenido a Mail Tenant'); + $mail->assertHasSubject('Bienvenido a OnTicket'); return str_contains($mail->render(), 'Ada Lovelace') - && str_contains($mail->render(), 'Mail Tenant') && str_contains($mail->render(), 'OnTicket') + && ! str_contains($mail->render(), 'Mail Tenant') && str_contains($mail->render(), 'border-top: 4px solid #ff7006'); }); } @@ -100,12 +100,13 @@ class NotificationMailServiceTest extends TestCase Mail::assertSent(Mailable::class, function (Mailable $mail): bool { $mail->assertTo('ada@example.com'); - $mail->assertHasSubject('Código para recuperar tu contraseña - Mail Tenant'); + $mail->assertHasSubject('Código para recuperar tu contraseña - OnTicket'); $rendered = $mail->render(); return str_contains($rendered, '0123') && str_contains($rendered, 'Ada Lovelace') - && str_contains($rendered, 'Mail Tenant') + && str_contains($rendered, 'OnTicket') + && ! str_contains($rendered, 'Mail Tenant') && str_contains($rendered, '#ff7006') && ! str_contains($rendered, 'border: 2px solid #112233'); });