fix: test email on for admins or custom smtp

This commit is contained in:
Andras Bacsai 2023-09-08 17:26:59 +02:00
parent 2e855e030f
commit f6c3fe7888
2 changed files with 20 additions and 21 deletions

View File

@ -21,7 +21,7 @@
Copy from Instance Settings Copy from Instance Settings
</x-forms.button> </x-forms.button>
@endif @endif
@if (isEmailEnabled($team) || data_get($team, 'use_instance_email_settings')) @if (isEmailEnabled($team) && auth()->user()->isAdminFromSession())
<x-forms.button onclick="sendTestEmail.showModal()" <x-forms.button onclick="sendTestEmail.showModal()"
class="text-white normal-case btn btn-xs no-animation btn-primary"> class="text-white normal-case btn btn-xs no-animation btn-primary">
Send Test Email Send Test Email
@ -36,10 +36,10 @@
label="Use hosted email service" /> label="Use hosted email service" />
</div> </div>
@else @else
<div class="pb-4 w-96"> <div class="pb-4 w-96">
<x-forms.checkbox disabled id="team.use_instance_email_settings" <x-forms.checkbox disabled id="team.use_instance_email_settings"
label="Use hosted email service (Pro+ subscription required)" /> label="Use hosted email service (Pro+ subscription required)" />
</div> </div>
@endif @endif
@if (!$team->use_instance_email_settings) @if (!$team->use_instance_email_settings)
<form class="flex flex-col items-end gap-2 pb-4 xl:flex-row" wire:submit.prevent='submitFromFields'> <form class="flex flex-col items-end gap-2 pb-4 xl:flex-row" wire:submit.prevent='submitFromFields'>
@ -112,25 +112,23 @@
<h2 class="mt-4">Subscribe to events</h2> <h2 class="mt-4">Subscribe to events</h2>
<div class="w-64"> <div class="w-64">
@if (isDev()) @if (isDev())
<h3 class="mt-4">Test</h3> <h3 class="mt-4">Test</h3>
<div class="flex items-end gap-10"> <div class="flex items-end gap-10">
<x-forms.checkbox instantSave="saveModel" id="team.smtp_notifications_test" label="Enabled" /> <x-forms.checkbox instantSave="saveModel" id="team.smtp_notifications_test" label="Enabled" />
</div> </div>
@endif @endif
<h3 class="mt-4">Container Status Changes</h3> <h3 class="mt-4">Container Status Changes</h3>
<div class="flex items-end gap-10"> <div class="flex items-end gap-10">
<x-forms.checkbox instantSave="saveModel" id="team.smtp_notifications_status_changes" <x-forms.checkbox instantSave="saveModel" id="team.smtp_notifications_status_changes" label="Enabled" />
label="Enabled" />
</div> </div>
<h3 class="mt-4">Application Deployments</h3> <h3 class="mt-4">Application Deployments</h3>
<div class="flex items-end gap-10"> <div class="flex items-end gap-10">
<x-forms.checkbox instantSave="saveModel" id="team.smtp_notifications_deployments" <x-forms.checkbox instantSave="saveModel" id="team.smtp_notifications_deployments" label="Enabled" />
label="Enabled" />
</div> </div>
<h3 class="mt-4">Backup Status</h3> <h3 class="mt-4">Backup Status</h3>
<div class="flex items-end gap-10"> <div class="flex items-end gap-10">
<x-forms.checkbox instantSave="saveModel" id="team.smtp_notifications_database_backups" <x-forms.checkbox instantSave="saveModel" id="team.smtp_notifications_database_backups"
label="Enabled" /> label="Enabled" />
</div> </div>
</div> </div>
@endif @endif

View File

@ -22,12 +22,12 @@
<x-forms.button type="submit"> <x-forms.button type="submit">
Save Save
</x-forms.button> </x-forms.button>
@if ($settings->resend_enabled || $settings->smtp_enabled) @if (isEmailEnabled($settings))
<x-forms.button onclick="sendTestEmail.showModal()" <x-forms.button onclick="sendTestEmail.showModal()"
class="text-white normal-case btn btn-xs no-animation btn-primary"> class="text-white normal-case btn btn-xs no-animation btn-primary">
Send Test Email Send Test Email
</x-forms.button> </x-forms.button>
@endif @endif
</div> </div>
</form> </form>
<div class="flex flex-col gap-4"> <div class="flex flex-col gap-4">
@ -74,7 +74,8 @@
<form wire:submit.prevent='submitResend' class="flex flex-col"> <form wire:submit.prevent='submitResend' class="flex flex-col">
<div class="flex flex-col gap-4"> <div class="flex flex-col gap-4">
<div class="flex flex-col w-full gap-2 xl:flex-row"> <div class="flex flex-col w-full gap-2 xl:flex-row">
<x-forms.input type="password" id="settings.resend_api_key" placeholder="API key" label="Host" /> <x-forms.input type="password" id="settings.resend_api_key" placeholder="API key"
label="Host" />
</div> </div>
</div> </div>
<div class="flex justify-end gap-4 pt-6"> <div class="flex justify-end gap-4 pt-6">