Răsfoiți Sursa

Update FollowerController, fix unfollow bug

Daniel Supernault 5 ani în urmă
părinte
comite
a3404a20e1
1 a modificat fișierele cu 1 adăugiri și 2 ștergeri
  1. 1 2
      app/Http/Controllers/FollowerController.php

+ 1 - 2
app/Http/Controllers/FollowerController.php

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