1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-25 09:17:03 +00:00

Update ApiV1Controller, filter mute/blocks on statuses/context and statuses/replies endpoints

This commit is contained in:
Daniel Supernault 2023-04-03 18:51:20 -06:00
parent 988818be69
commit 73aa01e8e0
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -2501,6 +2501,8 @@ class ApiV1Controller extends Controller
}
if($status['replies_count']) {
$filters = UserFilterService::filters($pid);
$descendants = DB::table('statuses')
->where('in_reply_to_id', $id)
->limit(20)
@ -2508,8 +2510,8 @@ class ApiV1Controller extends Controller
->map(function($sid) {
return StatusService::getMastodon($sid, false);
})
->filter(function($post) {
return $post && isset($post['account']);
->filter(function($post) use($filters) {
return $post && isset($post['account'], $post['account']['id']) && !in_array($post['account']['id'], $filters);
})
->map(function($status) use($pid) {
$status['favourited'] = LikeService::liked($pid, $status['id']);
@ -3358,7 +3360,11 @@ class ApiV1Controller extends Controller
->cursorPaginate($limit);
}
$data = $ids->map(function($post) use($pid) {
$filters = UserFilterService::filters($pid);
$data = $ids->filter(function($post) use($filters) {
return !in_array($post->profile_id, $filters);
})
->map(function($post) use($pid) {
$status = StatusService::get($post->id, false);
if(!$status || !isset($status['id'])) {