fix: test emails only available for user owned smtp/resend
This commit is contained in:
		@@ -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)
 | 
					function isEmailEnabled($notifiable)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return data_get($notifiable, 'smtp_enabled') || data_get($notifiable, 'resend_enabled') || data_get($notifiable, 'use_instance_email_settings');
 | 
					    return data_get($notifiable, 'smtp_enabled') || data_get($notifiable, 'resend_enabled') || data_get($notifiable, 'use_instance_email_settings');
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,7 +22,8 @@
 | 
				
			|||||||
                </x-forms.button>
 | 
					                </x-forms.button>
 | 
				
			||||||
            @endif
 | 
					            @endif
 | 
				
			||||||
            @if (isEmailEnabled($team) &&
 | 
					            @if (isEmailEnabled($team) &&
 | 
				
			||||||
                    auth()->user()->isAdminFromSession())
 | 
					                    auth()->user()->isAdminFromSession() &&
 | 
				
			||||||
 | 
					                    isTestEmailEnabled($team))
 | 
				
			||||||
                <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
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,7 +22,9 @@
 | 
				
			|||||||
            <x-forms.button type="submit">
 | 
					            <x-forms.button type="submit">
 | 
				
			||||||
                Save
 | 
					                Save
 | 
				
			||||||
            </x-forms.button>
 | 
					            </x-forms.button>
 | 
				
			||||||
            @if (isEmailEnabled($settings))
 | 
					            @if (isEmailEnabled($settings) &&
 | 
				
			||||||
 | 
					                    auth()->user()->isAdminFromSession() &&
 | 
				
			||||||
 | 
					                    isTestEmailEnabled($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
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user