mirror of https://github.com/pixelfed/pixelfed.git
Merge pull request #1593 from pixelfed/frontend-ui-refactor
Update FollowerController
This commit is contained in:
commit
001f4ca1e4
|
@ -53,7 +53,7 @@ class FollowerController extends Controller
|
||||||
abort(400, 'You cannot follow this user.');
|
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($private == true && $isFollowing == 0 || $remote == true) {
|
||||||
if($user->following()->count() >= Follower::MAX_FOLLOWING) {
|
if($user->following()->count() >= Follower::MAX_FOLLOWING) {
|
||||||
|
@ -83,6 +83,10 @@ class FollowerController extends Controller
|
||||||
$follower->profile_id = $user->id;
|
$follower->profile_id = $user->id;
|
||||||
$follower->following_id = $target->id;
|
$follower->following_id = $target->id;
|
||||||
$follower->save();
|
$follower->save();
|
||||||
|
|
||||||
|
if($remote == true && config('federation.activitypub.remoteFollow') == true) {
|
||||||
|
$this->sendFollow($user, $target);
|
||||||
|
}
|
||||||
FollowPipeline::dispatch($follower);
|
FollowPipeline::dispatch($follower);
|
||||||
} else {
|
} else {
|
||||||
$follower = Follower::whereProfileId($user->id)->whereFollowingId($target->id)->firstOrFail();
|
$follower = Follower::whereProfileId($user->id)->whereFollowingId($target->id)->firstOrFail();
|
||||||
|
|
Loading…
Reference in New Issue