mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 00:03:16 +00:00
Update Status model, fix thumb nsfw caching
This commit is contained in:
parent
6ea1db538a
commit
327ef1384b
1 changed files with 2 additions and 1 deletions
|
@ -89,7 +89,8 @@ class Status extends Model
|
||||||
|
|
||||||
public function thumb($showNsfw = false)
|
public function thumb($showNsfw = false)
|
||||||
{
|
{
|
||||||
return Cache::remember('status:thumb:'.$this->id, now()->addMinutes(15), function() use ($showNsfw) {
|
$key = $showNsfw ? 'status:thumb:nsfw1'.$this->id : 'status:thumb:nsfw0'.$this->id;
|
||||||
|
return Cache::remember($key, now()->addMinutes(15), function() use ($showNsfw) {
|
||||||
$type = $this->type ?? $this->setType();
|
$type = $this->type ?? $this->setType();
|
||||||
$is_nsfw = !$showNsfw ? $this->is_nsfw : false;
|
$is_nsfw = !$showNsfw ? $this->is_nsfw : false;
|
||||||
if ($this->media->count() == 0 || $is_nsfw || !in_array($type,['photo', 'photo:album', 'video'])) {
|
if ($this->media->count() == 0 || $is_nsfw || !in_array($type,['photo', 'photo:album', 'video'])) {
|
||||||
|
|
Loading…
Reference in a new issue