Merge pull request #2444 from pixelfed/staging

Update DiscoverController
This commit is contained in:
daniel 2020-11-21 18:58:36 -07:00 committed by GitHub
commit 5af87c7298
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -181,11 +181,13 @@ class DiscoverController extends Controller
$ttl = now()->addHours(2);
$res = Cache::remember($key, $ttl, function() use($range) {
if($range == '-1') {
$res = Status::orderBy('likes_count','desc')
$res = Status::whereVisibility('public')
->orderBy('likes_count','desc')
->take(12)
->get();
} else {
$res = Status::orderBy('likes_count','desc')
$res = Status::whereVisibility('public')
->orderBy('likes_count','desc')
->take(12)
->where('created_at', '>', now()->subDays($range))
->get();