Update FollowerController, fix unfollow bug

This commit is contained in:
Daniel Supernault 2019-09-23 18:47:41 -06:00
parent 6a80146b0c
commit a3404a20e1
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -38,7 +38,6 @@ class FollowerController extends Controller
{
$user = Auth::user()->profile;
$target = Profile::where('id', '!=', $user->id)->whereNull('status')->findOrFail($item);
$private = (bool) $target->is_private;
$remote = (bool) $target->domain;
@ -54,7 +53,7 @@ class FollowerController extends Controller
$isFollowing = Follower::whereProfileId($user->id)->whereFollowingId($target->id)->exists();
if($private == true && $isFollowing == 0 || $remote == true) {
if($private == true && $isFollowing == 0 && $remote == true) {
if($user->following()->count() >= Follower::MAX_FOLLOWING) {
abort(400, 'You cannot follow more than ' . Follower::MAX_FOLLOWING . ' accounts');
}