From d5f63f8a71ee9ff7d4a05dd89c724d6a8a3049e1 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 13 May 2023 05:41:09 -0600 Subject: [PATCH] Update AutoSpam Bouncer, generate notification on positive detections --- app/Util/Sentiment/Bouncer.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/Util/Sentiment/Bouncer.php b/app/Util/Sentiment/Bouncer.php index c0a151a9..aa59d140 100644 --- a/app/Util/Sentiment/Bouncer.php +++ b/app/Util/Sentiment/Bouncer.php @@ -6,8 +6,10 @@ use App\AccountInterstitial; use App\Status; use Cache; use Illuminate\Support\Str; +use App\Services\NotificationService; use App\Services\StatusService; use App\Jobs\ReportPipeline\AutospamNotifyAdminViaEmail; +use App\Notification; class Bouncer { @@ -140,6 +142,15 @@ class Bouncer { // $status->is_nsfw = true; $status->save(); + $notification = new Notification(); + $notification->profile_id = $status->profile_id; + $notification->actor_id = $status->profile_id; + $notification->action = 'autospam.warning'; + $notification->item_id = $status->id; + $notification->item_type = "App\Status"; + $notification->save(); + NotificationService::add($notification->profile_id, $notification->id); + StatusService::del($status->id); Cache::forget('pf:bouncer_v0:exemption_by_pid:' . $status->profile_id);