Update timeline controllers and routes

This commit is contained in:
Daniel Supernault 2018-12-10 20:41:41 -07:00
parent 90e41d9855
commit 582c4913d5
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
3 changed files with 10 additions and 54 deletions

View file

@ -31,28 +31,7 @@ class SiteController extends Controller
public function homeTimeline()
{
$pid = Auth::user()->profile->id;
// TODO: Use redis for timelines
$following = Follower::whereProfileId($pid)->pluck('following_id');
$following->push($pid)->toArray();
$filtered = UserFilter::whereUserId($pid)
->whereFilterableType('App\Profile')
->whereIn('filter_type', ['mute', 'block'])
->pluck('filterable_id')->toArray();
$timeline = Status::whereIn('profile_id', $following)
->whereNotIn('profile_id', $filtered)
->whereHas('media')
->whereVisibility('public')
->orderBy('created_at', 'desc')
->withCount(['comments', 'likes', 'shares'])
->simplePaginate(20);
$type = 'personal';
return view('timeline.template', compact('timeline', 'type'));
return view('timeline.home');
}
public function changeLocale(Request $request, $locale)