forked from mirror/pixelfed
commit
ac093bee01
2 changed files with 9 additions and 12 deletions
|
@ -131,6 +131,7 @@
|
||||||
- Updated Profile model, improve counter caching. ([4a14e970](https://github.com/pixelfed/pixelfed/commit/4a14e970))
|
- Updated Profile model, improve counter caching. ([4a14e970](https://github.com/pixelfed/pixelfed/commit/4a14e970))
|
||||||
- Updated ComposeModal, fix filter bug on safari. ([8e3e7586](https://github.com/pixelfed/pixelfed/commit/8e3e7586))
|
- Updated ComposeModal, fix filter bug on safari. ([8e3e7586](https://github.com/pixelfed/pixelfed/commit/8e3e7586))
|
||||||
- Updated StatusStatelessController, remove unused attributes. ([d0d46807](https://github.com/pixelfed/pixelfed/commit/d0d46807))
|
- Updated StatusStatelessController, remove unused attributes. ([d0d46807](https://github.com/pixelfed/pixelfed/commit/d0d46807))
|
||||||
|
- Updated Profile, fix follower counter bug. ([d06bec9c](https://github.com/pixelfed/pixelfed/commit/d06bec9c))
|
||||||
|
|
||||||
## [v0.10.9 (2020-04-17)](https://github.com/pixelfed/pixelfed/compare/v0.10.8...v0.10.9)
|
## [v0.10.9 (2020-04-17)](https://github.com/pixelfed/pixelfed/compare/v0.10.8...v0.10.9)
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -65,13 +65,11 @@ class Profile extends Model
|
||||||
public function followingCount($short = false)
|
public function followingCount($short = false)
|
||||||
{
|
{
|
||||||
$count = Cache::remember('profile:following_count:'.$this->id, now()->addMonths(1), function() {
|
$count = Cache::remember('profile:following_count:'.$this->id, now()->addMonths(1), function() {
|
||||||
$count = $this->following_count;
|
|
||||||
if($count) {
|
|
||||||
return $count;
|
|
||||||
}
|
|
||||||
$count = $this->following()->count();
|
$count = $this->following()->count();
|
||||||
$this->following_count = $count;
|
if($this->following_count != $count) {
|
||||||
$this->save();
|
$this->following_count = $count;
|
||||||
|
$this->save();
|
||||||
|
}
|
||||||
return $count;
|
return $count;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -81,13 +79,11 @@ class Profile extends Model
|
||||||
public function followerCount($short = false)
|
public function followerCount($short = false)
|
||||||
{
|
{
|
||||||
$count = Cache::remember('profile:follower_count:'.$this->id, now()->addMonths(1), function() {
|
$count = Cache::remember('profile:follower_count:'.$this->id, now()->addMonths(1), function() {
|
||||||
$count = $this->followers_count;
|
|
||||||
if($count) {
|
|
||||||
return $count;
|
|
||||||
}
|
|
||||||
$count = $this->followers()->count();
|
$count = $this->followers()->count();
|
||||||
$this->followers_count = $count;
|
if($this->followers_count != $count) {
|
||||||
$this->save();
|
$this->followers_count = $count;
|
||||||
|
$this->save();
|
||||||
|
}
|
||||||
return $count;
|
return $count;
|
||||||
});
|
});
|
||||||
return $short ? PrettyNumber::convert($count) : $count;
|
return $short ? PrettyNumber::convert($count) : $count;
|
||||||
|
|
Loading…
Reference in a new issue