diff --git a/app/Http/Controllers/Admin/AdminReportController.php b/app/Http/Controllers/Admin/AdminReportController.php index 537c72be0..8e0bd69cb 100644 --- a/app/Http/Controllers/Admin/AdminReportController.php +++ b/app/Http/Controllers/Admin/AdminReportController.php @@ -81,4 +81,35 @@ trait AdminReportController return $this; } + + protected function actionMap() + { + return [ + '1' => 'ignore', + '2' => 'cw', + '3' => 'unlist', + '4' => 'delete', + '5' => 'shadowban', + '6' => 'ban' + ]; + } + + public function bulkUpdateReport(Request $request) + { + $this->validate($request, [ + 'action' => 'required|integer|min:1|max:10', + 'ids' => 'required|array' + ]); + $action = $this->actionMap()[$request->input('action')]; + $ids = $request->input('ids'); + $reports = Report::whereIn('id', $ids)->whereNull('admin_seen')->get(); + foreach($reports as $report) { + $this->handleReportAction($report, $action); + } + $res = [ + 'message' => 'Success', + 'code' => 200 + ]; + return response()->json($res); + } } diff --git a/resources/views/admin/reports/home.blade.php b/resources/views/admin/reports/home.blade.php index bb0c3acbd..3a48393aa 100644 --- a/resources/views/admin/reports/home.blade.php +++ b/resources/views/admin/reports/home.blade.php @@ -17,9 +17,39 @@
+
+
+
+
+
+
+ |
# | Reporter | Type | @@ -31,11 +61,18 @@||
---|---|---|---|---|---|
+ |
+
+
+
+
+ |
+ {{$report->id}} - + + | {{$report->reporter->username}} | {{$report->type}} | {{str_limit($report->reported()->url(), 25)}} | @@ -54,9 +91,80 @@ @endsection +@push('styles') + +@endpush + @push('scripts')