Update ReportController, add new report types

This commit is contained in:
Daniel Supernault 2021-02-15 02:49:17 -07:00
parent b1fd99644b
commit d4c647cb4d
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
1 changed files with 15 additions and 3 deletions

View File

@ -23,7 +23,7 @@ class ReportController extends Controller
$this->validate($request, [
'type' => 'required|alpha_dash',
'id' => 'required|integer|min:1',
]);
]);
return view('report.form');
}
@ -98,7 +98,19 @@ class ReportController extends Controller
$object_type = $request->input('type');
$msg = $request->input('msg');
$object = null;
$types = ['spam', 'sensitive', 'abusive'];
$types = [
// original 3
'spam',
'sensitive',
'abusive',
// new
'underage',
'copyright',
'impersonation',
'scam',
'terrorism'
];
if (!in_array($reportType, $types)) {
return redirect('/timeline')->with('error', 'Invalid report type');
@ -134,7 +146,7 @@ class ReportController extends Controller
$report->object_type = $object_type;
$report->reported_profile_id = $object->profile_id;
$report->type = $request->input('report');
$report->message = $request->input('msg');
$report->message = e($request->input('msg'));
$report->save();
return redirect('/timeline')->with('status', 'Report successfully sent!');