mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 06:21:27 +00:00
Update Embeds. Fix Profile + Status embeds, remove following count and improve cache invalidation and hidden follower counts
This commit is contained in:
parent
d31a1dbcdf
commit
5ac9d0e8f2
6 changed files with 29 additions and 11 deletions
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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!');
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue