Update PublicApiController, enforce only_media on accountStatuses method. Fixes #3105

This commit is contained in:
Daniel Supernault 2022-01-05 19:31:49 -07:00
parent 9169d40ce0
commit 861a2d36df
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -737,6 +737,7 @@ class PublicApiController extends Controller
$max_id = $request->max_id; $max_id = $request->max_id;
$min_id = $request->min_id; $min_id = $request->min_id;
$scope = ['photo', 'photo:album', 'video', 'video:album']; $scope = ['photo', 'photo:album', 'video', 'video:album'];
$onlyMedia = $request->input('only_media', true);
if(!$min_id && !$max_id) { if(!$min_id && !$max_id) {
$min_id = 1; $min_id = 1;
@ -787,7 +788,16 @@ class PublicApiController extends Controller
} }
return $status; 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; return $s;
}) })
->values(); ->values();