From 2ab2c9a9744d09da327ee83afd0d862e9210c78a Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 25 Nov 2020 17:59:13 -0700 Subject: [PATCH 1/6] Update DiscoverController, fix trending api --- app/Http/Controllers/DiscoverController.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/DiscoverController.php b/app/Http/Controllers/DiscoverController.php index 113239cf1..c8b57c2a0 100644 --- a/app/Http/Controllers/DiscoverController.php +++ b/app/Http/Controllers/DiscoverController.php @@ -177,16 +177,20 @@ class DiscoverController extends Controller $request->input('range') == 'alltime' ? '-1' : ($request->input('range') == 'daily' ? 1 : 31) : 1; - $key = ':api:discover:trending:v1:range:' . $range; + $key = ':api:discover:trending:v2:range:' . $range; $ttl = now()->addHours(2); $res = Cache::remember($key, $ttl, function() use($range) { if($range == '-1') { $res = Status::whereVisibility('public') + ->whereType('photo') + ->whereIsNsfw(false) ->orderBy('likes_count','desc') ->take(12) ->get(); } else { $res = Status::whereVisibility('public') + ->whereType('photo') + ->whereIsNsfw(false) ->orderBy('likes_count','desc') ->take(12) ->where('created_at', '>', now()->subDays($range)) From 0d3575fea4f27f9a189e11fce8919a6a05374229 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 25 Nov 2020 18:00:49 -0700 Subject: [PATCH 2/6] Update vue components --- resources/assets/js/components/DiscoverComponent.vue | 6 +++--- resources/assets/js/components/Timeline.vue | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/resources/assets/js/components/DiscoverComponent.vue b/resources/assets/js/components/DiscoverComponent.vue index 34bbe3224..51bab70ab 100644 --- a/resources/assets/js/components/DiscoverComponent.vue +++ b/resources/assets/js/components/DiscoverComponent.vue @@ -81,7 +81,7 @@ -
+