From ee9f0795519b9681f13625cdfb5ff667f49f5c0b Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 4 Sep 2021 03:17:54 -0600 Subject: [PATCH 1/2] Update Profile, fix following count bug --- app/Profile.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Profile.php b/app/Profile.php index 3d1bea069..fbaa1878d 100644 --- a/app/Profile.php +++ b/app/Profile.php @@ -65,11 +65,11 @@ class Profile extends Model public function followingCount($short = false) { - $count = Cache::remember('profile:following_count:'.$this->id, now()->addMonths(1), function() { + $count = Cache::remember('profile:following_count:v1:'.$this->id, now()->addMonths(1), function() { if($this->domain == null && $this->user->settings->show_profile_following_count == false) { return 0; } - $count = DB::table('followers')->select('following_id')->where('following_id', $this->id)->count(); + $count = DB::table('followers')->where('profile_id', $this->id)->count(); if($this->following_count != $count) { $this->following_count = $count; $this->save(); @@ -82,11 +82,11 @@ class Profile extends Model public function followerCount($short = false) { - $count = Cache::remember('profile:follower_count:'.$this->id, now()->addMonths(1), function() { + $count = Cache::remember('profile:follower_count:v1:'.$this->id, now()->addMonths(1), function() { if($this->domain == null && $this->user->settings->show_profile_follower_count == false) { return 0; } - $count = $this->followers()->count(); + $count = DB::table('followers')->where('following_id', $this->id)->count(); if($this->followers_count != $count) { $this->followers_count = $count; $this->save(); From 29d7514a55820ee82c7449fb1b0b4423eed5fea8 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 4 Sep 2021 03:18:19 -0600 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d5c5a76f..7b7aefe8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -105,6 +105,7 @@ - Updated Timeline, remove recent posts. ([7641b731](https://github.com/pixelfed/pixelfed/commit/7641b731)) - Updated InstanceCrawlPipeline, remove unused variable. ([e73cf531](https://github.com/pixelfed/pixelfed/commit/e73cf531)) - Updated StoryComposeController, fix expiry bug. ([7dee8f58](https://github.com/pixelfed/pixelfed/commit/7dee8f58)) +- Updated Profile, fix following count bug. ([ee9f0795](https://github.com/pixelfed/pixelfed/commit/ee9f0795)) - ([](https://github.com/pixelfed/pixelfed/commit/)) ## [v0.11.0 (2021-06-01)](https://github.com/pixelfed/pixelfed/compare/v0.10.10...v0.11.0)