From cf77797512f9ae118d543779bd545680688ec28c Mon Sep 17 00:00:00 2001 From: philipp lang Date: Wed, 10 Jul 2024 00:52:05 +0200 Subject: [PATCH] Fix PreventionRememberAction --- app/Form/Actions/PreventionRememberAction.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/app/Form/Actions/PreventionRememberAction.php b/app/Form/Actions/PreventionRememberAction.php index e999337a..25903b8f 100644 --- a/app/Form/Actions/PreventionRememberAction.php +++ b/app/Form/Actions/PreventionRememberAction.php @@ -23,18 +23,14 @@ class PreventionRememberAction ->orWhereNull('last_remembered_at') ); foreach ($query->get() as $participant) { - if (count($participant->preventions()) === 0) { - return; + if ($participant->getFields()->getMailRecipient() === null || count($participant->preventions()) === 0) { + continue; } $body = app(PreventionSettings::class)->refresh()->formmail ->placeholder('formname', $participant->form->name) ->append($participant->form->prevention_text); - if ($participant->getFields()->getMailRecipient() === null) { - continue; - } - Mail::send(new PreventionRememberMail($participant, $body)); $participant->update(['last_remembered_at' => now()]);