1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-25 09:17:03 +00:00

Update unfollow api endpoint to only decrement when appropriate, fixes #3539

This commit is contained in:
Daniel Supernault 2022-08-01 19:05:22 -06:00
parent 7863120292
commit 44de1ad748
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -753,7 +753,9 @@ class ApiV1Controller extends Controller
abort(400, 'You can only follow or unfollow ' . Follower::FOLLOW_PER_HOUR . ' users per hour');
}
if($user->profile->following_count) {
$user->profile->decrement('following_count');
}
FollowRequest::whereFollowerId($user->profile_id)
->whereFollowingId($target->id)