1
0
Fork 0

Update TimelineController

This commit is contained in:
Daniel Supernault 2018-11-19 19:00:21 -07:00
parent c41e6a761d
commit e7c4f084bc
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
1 changed files with 7 additions and 8 deletions

View File

@ -27,14 +27,13 @@ class TimelineController extends Controller
// $timeline = Timeline::build()->local();
$pid = Auth::user()->profile->id;
$filtered = Cache::rememberForever("user:filter:list:$pid", function() use($pid) {
return UserFilter::whereUserId($pid)
->whereFilterableType('App\Profile')
->whereIn('filter_type', ['mute', 'block'])
->pluck('filterable_id')->toArray();
});
$private = Profile::whereIsPrivate(true)->pluck('id');
$filtered = array_merge($private->toArray(), $filtered);
$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')