From 327ef1384bd4ccf254192f4121cce5c92429e801 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 5 Dec 2020 00:12:08 -0700 Subject: [PATCH] Update Status model, fix thumb nsfw caching --- app/Status.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Status.php b/app/Status.php index 6232a335..3b6f6120 100644 --- a/app/Status.php +++ b/app/Status.php @@ -89,7 +89,8 @@ class Status extends Model 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(); $is_nsfw = !$showNsfw ? $this->is_nsfw : false; if ($this->media->count() == 0 || $is_nsfw || !in_array($type,['photo', 'photo:album', 'video'])) {