diff --git a/app/Http/Controllers/DiscoverController.php b/app/Http/Controllers/DiscoverController.php index 60fa266a..2277e8ee 100644 --- a/app/Http/Controllers/DiscoverController.php +++ b/app/Http/Controllers/DiscoverController.php @@ -96,8 +96,12 @@ class DiscoverController extends Controller }) ->values(); } else { + if($page != 1) { + $res['tags'] = []; + return $res; + } $key = 'discover:tags:public_feed:' . $hashtag->id . ':page:' . $page; - $tags = Cache::remember($key, 900, function() use($hashtag, $page, $end) { + $tags = Cache::remember($key, 43200, function() use($hashtag, $page, $end) { return collect(StatusHashtagService::get($hashtag->id, $page, $end)) ->filter(function($tag) { if(!$tag['status']['local']) { diff --git a/app/Services/StatusHashtagService.php b/app/Services/StatusHashtagService.php index d0d8b255..ececca63 100644 --- a/app/Services/StatusHashtagService.php +++ b/app/Services/StatusHashtagService.php @@ -26,7 +26,6 @@ class StatusHashtagService { return StatusHashtag::whereHashtagId($id) ->whereStatusVisibility('public') - ->whereHas('media') ->skip($stop) ->latest() ->take(9) @@ -35,7 +34,10 @@ class StatusHashtagService { return self::getStatus($i, $id); }) ->filter(function ($i) use($filtered) { - return isset($i['status']) && !empty($i['status']) && !in_array($i['status']['account']['id'], $filtered); + return isset($i['status']) && + !empty($i['status']) && !in_array($i['status']['account']['id'], $filtered) && + isset($i['status']['media_attachments']) && + !empty($i['status']['media_attachments']); }) ->values(); }