diff --git a/CHANGELOG.md b/CHANGELOG.md index e8413d3ec..26b867507 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,7 @@ - Updated ComposeModal, show filter warning for unsupported browsers. ([12ce7602](https://github.com/pixelfed/pixelfed/commit/12ce7602)) - Updated Hashtag component, fix null infinite loading bug. Fixes #2637. ([55136518](https://github.com/pixelfed/pixelfed/commit/55136518)) - Updated filesystems config, add backup driver to store backups on other filesystems. ([ae90eef9](https://github.com/pixelfed/pixelfed/commit/ae90eef9)) +- Updated Embeds. Fix Profile + Status embeds, remove following count and improve cache invalidation and hidden follower counts. ([5ac9d0e8](https://github.com/pixelfed/pixelfed/commit/5ac9d0e8)) - ([](https://github.com/pixelfed/pixelfed/commit/)) ## [v0.10.10 (2021-01-28)](https://github.com/pixelfed/pixelfed/compare/v0.10.9...v0.10.10) diff --git a/app/Http/Controllers/ComposeController.php b/app/Http/Controllers/ComposeController.php index d2003dddc..6e8d28358 100644 --- a/app/Http/Controllers/ComposeController.php +++ b/app/Http/Controllers/ComposeController.php @@ -427,6 +427,7 @@ class ComposeController extends Controller Cache::forget('profile:status_count:'.$profile->id); Cache::forget('status:transformer:media:attachments:'.$status->id); Cache::forget($user->storageUsedKey()); + Cache::forget('profile:embed:' . $status->profile_id); return $status->url(); } diff --git a/app/Http/Controllers/Settings/PrivacySettings.php b/app/Http/Controllers/Settings/PrivacySettings.php index 91f1ac43c..30bc40909 100644 --- a/app/Http/Controllers/Settings/PrivacySettings.php +++ b/app/Http/Controllers/Settings/PrivacySettings.php @@ -74,6 +74,9 @@ trait PrivacySettings } Cache::forget('profile:settings:' . $profile->id); Cache::forget('user:account:id:' . $profile->user_id); + Cache::forget('profile:follower_count:' . $profile->id); + Cache::forget('profile:following_count:' . $profile->id); + Cache::forget('profile:embed:' . $profile->id); return redirect(route('settings.privacy'))->with('status', 'Settings successfully updated!'); } diff --git a/app/Profile.php b/app/Profile.php index c527cccd5..d4532fcb1 100644 --- a/app/Profile.php +++ b/app/Profile.php @@ -65,6 +65,9 @@ class Profile extends Model public function followingCount($short = false) { $count = Cache::remember('profile:following_count:'.$this->id, now()->addMonths(1), function() { + if($this->domain == null && $this->user->settings->show_profile_following_count == false) { + return 0; + } $count = $this->following()->count(); if($this->following_count != $count) { $this->following_count = $count; @@ -79,6 +82,9 @@ class Profile extends Model public function followerCount($short = false) { $count = Cache::remember('profile:follower_count:'.$this->id, now()->addMonths(1), function() { + if($this->domain == null && $this->user->settings->show_profile_follower_count == false) { + return 0; + } $count = $this->followers()->count(); if($this->followers_count != $count) { $this->followers_count = $count; diff --git a/resources/views/profile/embed-removed.blade.php b/resources/views/profile/embed-removed.blade.php index 5cb28218b..7a49d2e79 100644 --- a/resources/views/profile/embed-removed.blade.php +++ b/resources/views/profile/embed-removed.blade.php @@ -18,7 +18,13 @@ -
-
+
+

Pixelfed

diff --git a/resources/views/profile/embed.blade.php b/resources/views/profile/embed.blade.php index 3d5e3de11..caf3fd3df 100644 --- a/resources/views/profile/embed.blade.php +++ b/resources/views/profile/embed.blade.php @@ -54,13 +54,9 @@

Posts

-

{{$profile->followers()->count()}}

+

{{$profile->followerCount(true)}}

Followers

-
-

{{$profile->following()->count()}}

-

Following

-
diff --git a/resources/views/status/embed-removed.blade.php b/resources/views/status/embed-removed.blade.php index 3e147ec89..e5f94525b 100644 --- a/resources/views/status/embed-removed.blade.php +++ b/resources/views/status/embed-removed.blade.php @@ -18,7 +18,13 @@ -
-
+
+

Pixelfed