From f8dc33cc8167f7ebfaa9fc2da9a7ecf9123870c1 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 21 Nov 2020 19:56:25 -0700 Subject: [PATCH] Update InternalApiController --- app/Http/Controllers/InternalApiController.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/InternalApiController.php b/app/Http/Controllers/InternalApiController.php index 4947e8c2e..6fe9a5bdf 100644 --- a/app/Http/Controllers/InternalApiController.php +++ b/app/Http/Controllers/InternalApiController.php @@ -80,18 +80,25 @@ class InternalApiController extends Controller }); $following = array_merge($following, $filters); + $sql = config('database.default') !== 'pgsql'; + $posts = Status::select( 'id', 'caption', + 'is_nsfw', 'profile_id', - 'type' + 'type', + 'uri', + 'created_at' ) ->whereNull('uri') ->whereIn('type', ['photo','photo:album', 'video']) ->whereIsNsfw(false) ->whereVisibility('public') ->whereNotIn('profile_id', $following) - ->whereDate('created_at', '>', now()->subMonths(3)) + ->when($sql, function($q, $s) { + return $q->where('created_at', '>', now()->subMonths(3)); + }) ->with('media') ->inRandomOrder() ->latest()