From b2fe219eeca0495f7326942a1c575a422604a10c Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 11 Jan 2021 00:31:21 -0700 Subject: [PATCH] Update DiscoverController, add albums and video to discover trending api --- app/Http/Controllers/DiscoverController.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/DiscoverController.php b/app/Http/Controllers/DiscoverController.php index 53c7e8caa..dbad2f3f8 100644 --- a/app/Http/Controllers/DiscoverController.php +++ b/app/Http/Controllers/DiscoverController.php @@ -170,26 +170,26 @@ class DiscoverController extends Controller public function trendingApi(Request $request) { $this->validate($request, [ - 'range' => 'nullable|string|in:daily,monthly,alltime' + 'range' => 'nullable|string|in:daily,monthly' ]); $range = $request->filled('range') ? $request->input('range') == 'alltime' ? '-1' : ($request->input('range') == 'daily' ? 1 : 31) : 1; - $key = ':api:discover:trending:v2:range:' . $range; + $key = ':api:discover:trending:v2.1:range:' . $range; $ttl = now()->addHours(2); $res = Cache::remember($key, $ttl, function() use($range) { if($range == '-1') { $res = Status::whereScope('public') - ->whereType('photo') + ->whereIn('type', ['photo', 'photo:album', 'video']) ->whereIsNsfw(false) ->orderBy('likes_count','desc') ->take(12) ->get(); } else { $res = Status::whereScope('public') - ->whereType('photo') + ->whereIn('type', ['photo', 'photo:album', 'video']) ->whereIsNsfw(false) ->orderBy('likes_count','desc') ->take(12)