fix: test emails only available for user owned smtp/resend

This commit is contained in:
Andras Bacsai 2023-10-06 10:42:32 +02:00
parent a96ef1bfab
commit d32e43ef37
3 changed files with 9 additions and 2 deletions

View File

@ -343,6 +343,10 @@ function send_user_an_email(MailMessage $mail, string $email, ?string $cc = null
);
}
}
function isTestEmailEnabled($notifiable)
{
return data_get($notifiable, 'smtp_enabled') || data_get($notifiable, 'resend_enabled');
}
function isEmailEnabled($notifiable)
{
return data_get($notifiable, 'smtp_enabled') || data_get($notifiable, 'resend_enabled') || data_get($notifiable, 'use_instance_email_settings');

View File

@ -22,7 +22,8 @@
</x-forms.button>
@endif
@if (isEmailEnabled($team) &&
auth()->user()->isAdminFromSession())
auth()->user()->isAdminFromSession() &&
isTestEmailEnabled($team))
<x-forms.button onclick="sendTestEmail.showModal()"
class="text-white normal-case btn btn-xs no-animation btn-primary">
Send Test Email

View File

@ -22,7 +22,9 @@
<x-forms.button type="submit">
Save
</x-forms.button>
@if (isEmailEnabled($settings))
@if (isEmailEnabled($settings) &&
auth()->user()->isAdminFromSession() &&
isTestEmailEnabled($settings))
<x-forms.button onclick="sendTestEmail.showModal()"
class="text-white normal-case btn btn-xs no-animation btn-primary">
Send Test Email