Update timeline controllers and routes
This commit is contained in:
parent
90e41d9855
commit
582c4913d5
3 changed files with 10 additions and 54 deletions
|
@ -20,30 +20,6 @@ class TimelineController extends Controller
|
|||
|
||||
public function local(Request $request)
|
||||
{
|
||||
$this->validate($request,[
|
||||
'page' => 'nullable|integer|max:20'
|
||||
]);
|
||||
// TODO: Use redis for timelines
|
||||
// $timeline = Timeline::build()->local();
|
||||
$pid = Auth::user()->profile->id;
|
||||
|
||||
$private = Profile::whereIsPrivate(true)->where('id', '!=', $pid)->pluck('id');
|
||||
$filters = UserFilter::whereUserId($pid)
|
||||
->whereFilterableType('App\Profile')
|
||||
->whereIn('filter_type', ['mute', 'block'])
|
||||
->pluck('filterable_id')->toArray();
|
||||
$filtered = array_merge($private->toArray(), $filters);
|
||||
|
||||
$timeline = Status::whereHas('media')
|
||||
->whereNotIn('profile_id', $filtered)
|
||||
->whereNull('in_reply_to_id')
|
||||
->whereNull('reblog_of_id')
|
||||
->whereVisibility('public')
|
||||
->withCount(['comments', 'likes'])
|
||||
->orderBy('created_at', 'desc')
|
||||
->simplePaginate(10);
|
||||
$type = 'local';
|
||||
|
||||
return view('timeline.template', compact('timeline', 'type'));
|
||||
return view('timeline.local');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue