Update SiteController, return 404 for users attempting to view their own Follow Intent

This commit is contained in:
Daniel Supernault 2019-12-04 20:30:04 -07:00
parent 19cb81cf26
commit 8e9b544f50
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -116,6 +116,7 @@ class SiteController extends Controller
]); ]);
$profile = Profile::whereUsername($request->input('user'))->firstOrFail(); $profile = Profile::whereUsername($request->input('user'))->firstOrFail();
$user = $request->user(); $user = $request->user();
abort_if($profile->id == $user->profile_id, 404);
$following = $user != null ? FollowerService::follows($user->profile_id, $profile->id) : false; $following = $user != null ? FollowerService::follows($user->profile_id, $profile->id) : false;
return view('site.intents.follow', compact('profile', 'user', 'following')); return view('site.intents.follow', compact('profile', 'user', 'following'));
} }