Update FollowerController

This commit is contained in:
Daniel Supernault 2019-08-12 01:25:53 -06:00
parent 26646a70a9
commit a4bf848a3c
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -53,7 +53,7 @@ class FollowerController extends Controller
abort(400, 'You cannot follow this user.');
}
$isFollowing = Follower::whereProfileId($user->id)->whereFollowingId($target->id)->count();
$isFollowing = Follower::whereProfileId($user->id)->whereFollowingId($target->id)->exists();
if($private == true && $isFollowing == 0 || $remote == true) {
if($user->following()->count() >= Follower::MAX_FOLLOWING) {
@ -83,6 +83,10 @@ class FollowerController extends Controller
$follower->profile_id = $user->id;
$follower->following_id = $target->id;
$follower->save();
if($remote == true && config('federation.activitypub.remoteFollow') == true) {
$this->sendFollow($user, $target);
}
FollowPipeline::dispatch($follower);
} else {
$follower = Follower::whereProfileId($user->id)->whereFollowingId($target->id)->firstOrFail();