1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-26 01:36:43 +00:00

Update discover controller

This commit is contained in:
Daniel Supernault 2018-09-21 23:31:21 -06:00
parent c0609671c2
commit 809423914f
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -19,8 +19,12 @@ class DiscoverController extends Controller
$this->middleware('auth'); $this->middleware('auth');
} }
public function home() public function home(Request $request)
{ {
$this->validate($request, [
'page' => 'nullable|integer|max:50'
]);
$pid = Auth::user()->profile->id; $pid = Auth::user()->profile->id;
$following = Cache::remember('feature:discover:following:'.$pid, 15, function() use($pid) { $following = Cache::remember('feature:discover:following:'.$pid, 15, function() use($pid) {
@ -52,6 +56,7 @@ class DiscoverController extends Controller
->whereHas('profile', function($q) { ->whereHas('profile', function($q) {
$q->where('is_private', false); $q->where('is_private', false);
}) })
->whereIsNsfw(false)
->whereVisibility('public') ->whereVisibility('public')
->where('profile_id', '!=', $pid) ->where('profile_id', '!=', $pid)
->whereNotIn('profile_id', $following) ->whereNotIn('profile_id', $following)