mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-25 06:23:18 +00:00
Update SiteController
This commit is contained in:
parent
64ff569634
commit
c41e6a761d
1 changed files with 5 additions and 8 deletions
|
@ -33,18 +33,14 @@ class SiteController extends Controller
|
||||||
{
|
{
|
||||||
$pid = Auth::user()->profile->id;
|
$pid = Auth::user()->profile->id;
|
||||||
// TODO: Use redis for timelines
|
// TODO: Use redis for timelines
|
||||||
$following = Cache::rememberForever("user:following:list:$pid", function() use($pid) {
|
|
||||||
$following = Follower::whereProfileId($pid)->pluck('following_id');
|
|
||||||
$following->push($pid);
|
|
||||||
return $following->toArray();
|
|
||||||
});
|
|
||||||
|
|
||||||
$filtered = Cache::rememberForever("user:filter:list:$pid", function() use($pid) {
|
$following = Follower::whereProfileId($pid)->pluck('following_id');
|
||||||
return UserFilter::whereUserId($pid)
|
$following->push($pid)->toArray();
|
||||||
|
|
||||||
|
$filtered = UserFilter::whereUserId($pid)
|
||||||
->whereFilterableType('App\Profile')
|
->whereFilterableType('App\Profile')
|
||||||
->whereIn('filter_type', ['mute', 'block'])
|
->whereIn('filter_type', ['mute', 'block'])
|
||||||
->pluck('filterable_id')->toArray();
|
->pluck('filterable_id')->toArray();
|
||||||
});
|
|
||||||
|
|
||||||
$timeline = Status::whereIn('profile_id', $following)
|
$timeline = Status::whereIn('profile_id', $following)
|
||||||
->whereNotIn('profile_id', $filtered)
|
->whereNotIn('profile_id', $filtered)
|
||||||
|
@ -53,6 +49,7 @@ class SiteController extends Controller
|
||||||
->orderBy('created_at', 'desc')
|
->orderBy('created_at', 'desc')
|
||||||
->withCount(['comments', 'likes', 'shares'])
|
->withCount(['comments', 'likes', 'shares'])
|
||||||
->simplePaginate(20);
|
->simplePaginate(20);
|
||||||
|
|
||||||
$type = 'personal';
|
$type = 'personal';
|
||||||
|
|
||||||
return view('timeline.template', compact('timeline', 'type'));
|
return view('timeline.template', compact('timeline', 'type'));
|
||||||
|
|
Loading…
Reference in a new issue