forked from mirror/pixelfed
Update PublicApiControllers, fix block/mutes filtering on public timeline
This commit is contained in:
parent
9dfb369d17
commit
08383dd43d
1 changed files with 7 additions and 0 deletions
|
@ -239,6 +239,11 @@ class PublicApiController extends Controller
|
||||||
$max = $request->input('max_id');
|
$max = $request->input('max_id');
|
||||||
$limit = $request->input('limit') ?? 3;
|
$limit = $request->input('limit') ?? 3;
|
||||||
|
|
||||||
|
$filtered = UserFilter::whereUserId(Auth::user()->profile_id)
|
||||||
|
->whereFilterableType('App\Profile')
|
||||||
|
->whereIn('filter_type', ['mute', 'block'])
|
||||||
|
->pluck('filterable_id')->toArray();
|
||||||
|
|
||||||
if($min || $max) {
|
if($min || $max) {
|
||||||
$dir = $min ? '>' : '<';
|
$dir = $min ? '>' : '<';
|
||||||
$id = $min ?? $max;
|
$id = $min ?? $max;
|
||||||
|
@ -263,6 +268,7 @@ class PublicApiController extends Controller
|
||||||
'updated_at'
|
'updated_at'
|
||||||
)->where('id', $dir, $id)
|
)->where('id', $dir, $id)
|
||||||
->whereIn('type', ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'])
|
->whereIn('type', ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'])
|
||||||
|
->whereNotIn('profile_id', $filtered)
|
||||||
->whereLocal(true)
|
->whereLocal(true)
|
||||||
->whereVisibility('public')
|
->whereVisibility('public')
|
||||||
->orderBy('created_at', 'desc')
|
->orderBy('created_at', 'desc')
|
||||||
|
@ -289,6 +295,7 @@ class PublicApiController extends Controller
|
||||||
'reblogs_count',
|
'reblogs_count',
|
||||||
'updated_at'
|
'updated_at'
|
||||||
)->whereIn('type', ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'])
|
)->whereIn('type', ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'])
|
||||||
|
->whereNotIn('profile_id', $filtered)
|
||||||
->with('profile', 'hashtags', 'mentions')
|
->with('profile', 'hashtags', 'mentions')
|
||||||
->whereLocal(true)
|
->whereLocal(true)
|
||||||
->whereVisibility('public')
|
->whereVisibility('public')
|
||||||
|
|
Loading…
Reference in a new issue