Update AutoSpam Bouncer, generate notification on positive detections

This commit is contained in:
Daniel Supernault 2023-05-13 05:41:09 -06:00
parent 0d3b4bc225
commit d5f63f8a71
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -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);