|
|
@ -113,8 +113,12 @@ class ReportController extends Controller
|
|
|
|
];
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
if (!in_array($reportType, $types)) {
|
|
|
|
if (!in_array($reportType, $types)) {
|
|
|
|
|
|
|
|
if($request->wantsJson()) {
|
|
|
|
|
|
|
|
return abort(400, 'Invalid report type');
|
|
|
|
|
|
|
|
} else {
|
|
|
|
return redirect('/timeline')->with('error', 'Invalid report type');
|
|
|
|
return redirect('/timeline')->with('error', 'Invalid report type');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch ($object_type) {
|
|
|
|
switch ($object_type) {
|
|
|
|
case 'post':
|
|
|
|
case 'post':
|
|
|
@ -127,17 +131,29 @@ class ReportController extends Controller
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
|
|
|
|
if($request->wantsJson()) {
|
|
|
|
|
|
|
|
return abort(400, 'Invalid report type');
|
|
|
|
|
|
|
|
} else {
|
|
|
|
return redirect('/timeline')->with('error', 'Invalid report type');
|
|
|
|
return redirect('/timeline')->with('error', 'Invalid report type');
|
|
|
|
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ($exists !== 0) {
|
|
|
|
if ($exists !== 0) {
|
|
|
|
|
|
|
|
if($request->wantsJson()) {
|
|
|
|
|
|
|
|
return response()->json(200);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
return redirect('/timeline')->with('error', 'You have already reported this!');
|
|
|
|
return redirect('/timeline')->with('error', 'You have already reported this!');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ($object->profile_id == $profile->id) {
|
|
|
|
if ($object->profile_id == $profile->id) {
|
|
|
|
|
|
|
|
if($request->wantsJson()) {
|
|
|
|
|
|
|
|
return response()->json(200);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
return redirect('/timeline')->with('error', 'You cannot report your own content!');
|
|
|
|
return redirect('/timeline')->with('error', 'You cannot report your own content!');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$report = new Report();
|
|
|
|
$report = new Report();
|
|
|
|
$report->profile_id = $profile->id;
|
|
|
|
$report->profile_id = $profile->id;
|
|
|
@ -149,6 +165,10 @@ class ReportController extends Controller
|
|
|
|
$report->message = e($request->input('msg'));
|
|
|
|
$report->message = e($request->input('msg'));
|
|
|
|
$report->save();
|
|
|
|
$report->save();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if($request->wantsJson()) {
|
|
|
|
|
|
|
|
return response()->json(200);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
return redirect('/timeline')->with('status', 'Report successfully sent!');
|
|
|
|
return redirect('/timeline')->with('status', 'Report successfully sent!');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|