Skip to content

Commit

Permalink
Update AutoSpam Bouncer, generate notification on positive detections
Browse files Browse the repository at this point in the history
  • Loading branch information
dansup committed May 13, 2023
1 parent 0d3b4bc commit d5f63f8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/Util/Sentiment/Bouncer.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
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 {

Expand Down Expand Up @@ -140,6 +142,15 @@ protected function handle($status)
// $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);
Expand Down

0 comments on commit d5f63f8

Please sign in to comment.