mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-10 00:34:50 +00:00
Merge pull request #945 from pixelfed/frontend-ui-refactor
Update DiscoverController
This commit is contained in:
commit
b3a7512ef1
1 changed files with 27 additions and 3 deletions
|
@ -36,15 +36,39 @@ class DiscoverController extends Controller
|
|||
$keyMinutes = 15;
|
||||
|
||||
$posts = Cache::remember($key, now()->addMinutes($keyMinutes), function() use ($tag, $request) {
|
||||
return $tag->posts()
|
||||
$tags = StatusHashtag::select('status_id')
|
||||
->whereHashtagId($tag->id)
|
||||
->orderByDesc('id')
|
||||
->take(48)
|
||||
->pluck('status_id');
|
||||
|
||||
return Status::select(
|
||||
'id',
|
||||
'uri',
|
||||
'caption',
|
||||
'rendered',
|
||||
'profile_id',
|
||||
'type',
|
||||
'in_reply_to_id',
|
||||
'reblog_of_id',
|
||||
'is_nsfw',
|
||||
'scope',
|
||||
'local',
|
||||
'created_at',
|
||||
'updated_at'
|
||||
)->whereIn('type', ['photo', 'photo:album', 'video', 'video:album'])
|
||||
->with('media')
|
||||
->whereLocal(true)
|
||||
->whereNull('uri')
|
||||
->whereIn('id', $tags)
|
||||
->whereNull('in_reply_to_id')
|
||||
->whereNull('reblog_of_id')
|
||||
->whereNull('url')
|
||||
->whereNull('uri')
|
||||
->whereHas('media')
|
||||
->withCount(['likes', 'comments'])
|
||||
->whereIsNsfw(false)
|
||||
->whereVisibility('public')
|
||||
->orderBy('id', 'desc')
|
||||
->take(24)
|
||||
->get();
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue