mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-10 00:34:50 +00:00
Update AdminReportController
This commit is contained in:
parent
2fa6adf705
commit
1e839d2517
1 changed files with 31 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue