Merge pull request #2641 from pixelfed/staging

Fix Profile + Status embeds, remove following count and improve cache invalidation and hidden follower counts.
This commit is contained in:
daniel 2021-02-09 00:45:04 -07:00 committed by GitHub
commit 4150a72b18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 30 additions and 11 deletions

View file

@ -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)

View file

@ -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();
}

View file

@ -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!');
}

View file

@ -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;

View file

@ -18,7 +18,13 @@
<link rel="apple-touch-icon" type="image/png" href="/img/favicon.png?v=2">
<link href="{{ mix('css/app.css') }}" rel="stylesheet">
<style type="text/css">
body.embed-card {
.embed-card {
display: flex;
align-items: center;
justify-content: center;
width: 100vw;
height: 100vh;
min-height: 573px;
background: #fff !important;
margin: 0;
padding-bottom: 0;
@ -31,8 +37,8 @@
</style>
</head>
<body class="bg-white">
<div class="embed-card">
<div class="card status-card-embed card-md-rounded-0 border card-body border shadow-none rounded-0 d-flex justify-content-center align-items-center">
<div class="embed-card border">
<div class="card status-card-embed card-md-rounded-0 card-body shadow-none rounded-0">
<div class="text-center p-5">
<img src="/img/pixelfed-icon-color.svg" width="40px" height="40px">
<p class="h2 py-3 font-weight-bold">Pixelfed</p>

View file

@ -54,13 +54,9 @@
<p class="mb-0 text-muted text-uppercase small font-weight-bold">Posts</p>
</div>
<div class="text-center">
<p class="mb-0 font-weight-bold prettyCount">{{$profile->followers()->count()}}</p>
<p class="mb-0 font-weight-bold prettyCount">{{$profile->followerCount(true)}}</p>
<p class="mb-0 text-muted text-uppercase small font-weight-bold">Followers</p>
</div>
<div class="text-center">
<p class="mb-0 font-weight-bold prettyCount">{{$profile->following()->count()}}</p>
<p class="mb-0 text-muted text-uppercase small font-weight-bold">Following</p>
</div>
<div class="text-center">
<p class="mb-0"><a href="/i/intent/follow?user={{$profile->username}}" class="btn btn-primary btn-sm py-1 px-4 text-uppercase font-weight-bold" target="_blank">Follow</a></p>
</div>

View file

@ -18,7 +18,13 @@
<link rel="apple-touch-icon" type="image/png" href="/img/favicon.png?v=2">
<link href="{{ mix('css/app.css') }}" rel="stylesheet">
<style type="text/css">
body.embed-card {
.embed-card {
display: flex;
align-items: center;
justify-content: center;
width: 100vw;
height: 100vh;
min-height: 573px;
background: #fff !important;
margin: 0;
padding-bottom: 0;
@ -31,8 +37,8 @@
</style>
</head>
<body class="bg-white">
<div class="embed-card">
<div class="card status-card-embed card-md-rounded-0 border card-body border shadow-none rounded-0 d-flex justify-content-center align-items-center">
<div class="embed-card border">
<div class="card status-card-embed card-md-rounded-0 card-body shadow-none rounded-0">
<div class="text-center p-5">
<img src="/img/pixelfed-icon-color.svg" width="40px" height="40px">
<p class="h2 py-3 font-weight-bold">Pixelfed</p>