mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 00:03:16 +00:00
Update ReportController, add new report types
This commit is contained in:
parent
b1fd99644b
commit
d4c647cb4d
1 changed files with 15 additions and 3 deletions
|
@ -23,7 +23,7 @@ class ReportController extends Controller
|
||||||
$this->validate($request, [
|
$this->validate($request, [
|
||||||
'type' => 'required|alpha_dash',
|
'type' => 'required|alpha_dash',
|
||||||
'id' => 'required|integer|min:1',
|
'id' => 'required|integer|min:1',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return view('report.form');
|
return view('report.form');
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,19 @@ class ReportController extends Controller
|
||||||
$object_type = $request->input('type');
|
$object_type = $request->input('type');
|
||||||
$msg = $request->input('msg');
|
$msg = $request->input('msg');
|
||||||
$object = null;
|
$object = null;
|
||||||
$types = ['spam', 'sensitive', 'abusive'];
|
$types = [
|
||||||
|
// original 3
|
||||||
|
'spam',
|
||||||
|
'sensitive',
|
||||||
|
'abusive',
|
||||||
|
|
||||||
|
// new
|
||||||
|
'underage',
|
||||||
|
'copyright',
|
||||||
|
'impersonation',
|
||||||
|
'scam',
|
||||||
|
'terrorism'
|
||||||
|
];
|
||||||
|
|
||||||
if (!in_array($reportType, $types)) {
|
if (!in_array($reportType, $types)) {
|
||||||
return redirect('/timeline')->with('error', 'Invalid report type');
|
return redirect('/timeline')->with('error', 'Invalid report type');
|
||||||
|
@ -134,7 +146,7 @@ class ReportController extends Controller
|
||||||
$report->object_type = $object_type;
|
$report->object_type = $object_type;
|
||||||
$report->reported_profile_id = $object->profile_id;
|
$report->reported_profile_id = $object->profile_id;
|
||||||
$report->type = $request->input('report');
|
$report->type = $request->input('report');
|
||||||
$report->message = $request->input('msg');
|
$report->message = e($request->input('msg'));
|
||||||
$report->save();
|
$report->save();
|
||||||
|
|
||||||
return redirect('/timeline')->with('status', 'Report successfully sent!');
|
return redirect('/timeline')->with('status', 'Report successfully sent!');
|
||||||
|
|
Loading…
Reference in a new issue