From 1ef7732aef6a425da05041b7bc37b3b22039554d Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 26 Jul 2022 03:08:18 -0600 Subject: [PATCH 1/2] Update admin report view --- resources/views/admin/reports/show.blade.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/resources/views/admin/reports/show.blade.php b/resources/views/admin/reports/show.blade.php index e4b02dc6..3ab9d5f7 100644 --- a/resources/views/admin/reports/show.blade.php +++ b/resources/views/admin/reports/show.blade.php @@ -35,9 +35,17 @@

Timestamp: {{now()->parse($report->status->created_at)->format('r')}}

-

- URL: {{$report->status->url()}} +

+ Original URL: {{$report->status->url()}}

+

+ Local URL: {{url('/i/web/post/' . $report->status->id)}} +

+ @if($report->status->in_reply_to_id) +

+ Parent Post: {{url('/i/web/post/' . $report->status->in_reply_to_id)}} +

+ @endif @@ -49,7 +57,7 @@
- @{{$report->reportedUser->username}} stats + {{$report->reportedUser->username}} stats

@@ -108,4 +116,4 @@ }); }) -@endpush \ No newline at end of file +@endpush From b4bc9fe31ce59c6759acf244b72da4a6c1d1c01e Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 26 Jul 2022 03:11:28 -0600 Subject: [PATCH 2/2] Update AdminReportController --- .../Admin/AdminReportController.php | 35 +++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Admin/AdminReportController.php b/app/Http/Controllers/Admin/AdminReportController.php index 6732de4e..2ee3dd0f 100644 --- a/app/Http/Controllers/Admin/AdminReportController.php +++ b/app/Http/Controllers/Admin/AdminReportController.php @@ -73,7 +73,7 @@ trait AdminReportController public function showReport(Request $request, $id) { - $report = Report::findOrFail($id); + $report = Report::with('status')->findOrFail($id); return view('admin.reports.show', compact('report')); } @@ -245,7 +245,7 @@ trait AdminReportController public function updateSpam(Request $request, $id) { $this->validate($request, [ - 'action' => 'required|in:dismiss,approve,dismiss-all,approve-all,delete-account' + 'action' => 'required|in:dismiss,approve,dismiss-all,approve-all,delete-account,mark-spammer' ]); $action = $request->input('action'); @@ -342,6 +342,37 @@ trait AdminReportController return $res; } + if($action == 'mark-spammer') { + AccountInterstitial::whereType('post.autospam') + ->whereItemType('App\Status') + ->whereNull('appeal_handled_at') + ->whereUserId($appeal->user_id) + ->update(['appeal_handled_at' => $now, 'is_spam' => true]); + + $pro = Profile::whereUserId($appeal->user_id)->firstOrFail(); + + $pro->update([ + 'unlisted' => true, + 'cw' => true, + 'no_autolink' => true + ]); + + Status::whereProfileId($pro->id) + ->get() + ->each(function($report) { + $status->is_nsfw = $meta->is_nsfw; + $status->scope = 'public'; + $status->visibility = 'public'; + $status->save(); + StatusService::del($status->id, true); + }); + + Cache::forget('pf:bouncer_v0:exemption_by_pid:' . $appeal->user->profile_id); + Cache::forget('pf:bouncer_v0:recent_by_pid:' . $appeal->user->profile_id); + Cache::forget('admin-dash:reports:spam-count'); + return $res; + } + $status = $appeal->status; $status->is_nsfw = $meta->is_nsfw; $status->scope = 'public';