Skip to content

Beautiful Open-Source Form Builder

Prevent spam check dispatch in testing environment

Julien Nahumfaa16acb16ed
diff --git a/api/app/Listeners/Forms/FormSpamCheckListener.php b/api/app/Listeners/Forms/FormSpamCheckListener.php
index a78bf3848..75ed0064c 100644
--- a/api/app/Listeners/Forms/FormSpamCheckListener.php
+++ b/api/app/Listeners/Forms/FormSpamCheckListener.php
@@ -4,12 +4,16 @@ namespace App\Listeners\Forms;
use App\Events\Forms\FormSaved;
use App\Jobs\Form\CheckFormForSpam;
+use Illuminate\Support\Facades\App;
class FormSpamCheckListener
{
public function handle(FormSaved $event): void
{
- // We can add logic here to not queue for certain users if needed
+ if (App::environment('testing')) {
+ return;
+ }
+
CheckFormForSpam::dispatch($event->form);
}
}