mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 00:03:16 +00:00
Update PublicApiController, enforce only_media on accountStatuses method. Fixes #3105
This commit is contained in:
parent
9169d40ce0
commit
861a2d36df
1 changed files with 11 additions and 1 deletions
|
@ -737,6 +737,7 @@ class PublicApiController extends Controller
|
|||
$max_id = $request->max_id;
|
||||
$min_id = $request->min_id;
|
||||
$scope = ['photo', 'photo:album', 'video', 'video:album'];
|
||||
$onlyMedia = $request->input('only_media', true);
|
||||
|
||||
if(!$min_id && !$max_id) {
|
||||
$min_id = 1;
|
||||
|
@ -787,7 +788,16 @@ class PublicApiController extends Controller
|
|||
}
|
||||
return $status;
|
||||
})
|
||||
->filter(function($s) {
|
||||
->filter(function($s) use($onlyMedia) {
|
||||
if($onlyMedia) {
|
||||
if(
|
||||
!isset($s['media_attachments']) ||
|
||||
!is_array($s['media_attachments']) ||
|
||||
empty($s['media_attachments'])
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return $s;
|
||||
})
|
||||
->values();
|
||||
|
|
Loading…
Reference in a new issue