Skip to content

Commit d5f63f8

Browse files
committed
Update AutoSpam Bouncer, generate notification on positive detections
1 parent 0d3b4bc commit d5f63f8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

app/Util/Sentiment/Bouncer.php

+11
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
use App\Status;
77
use Cache;
88
use Illuminate\Support\Str;
9+
use App\Services\NotificationService;
910
use App\Services\StatusService;
1011
use App\Jobs\ReportPipeline\AutospamNotifyAdminViaEmail;
12+
use App\Notification;
1113

1214
class Bouncer {
1315

@@ -140,6 +142,15 @@ protected function handle($status)
140142
// $status->is_nsfw = true;
141143
$status->save();
142144

145+
$notification = new Notification();
146+
$notification->profile_id = $status->profile_id;
147+
$notification->actor_id = $status->profile_id;
148+
$notification->action = 'autospam.warning';
149+
$notification->item_id = $status->id;
150+
$notification->item_type = "App\Status";
151+
$notification->save();
152+
NotificationService::add($notification->profile_id, $notification->id);
153+
143154
StatusService::del($status->id);
144155

145156
Cache::forget('pf:bouncer_v0:exemption_by_pid:' . $status->profile_id);

0 commit comments

Comments
 (0)