Update ApiV1Controller, fix public timeline min/max id pagination

This commit is contained in:
Daniel Supernault 2022-06-15 03:32:04 -06:00
parent 154f23416a
commit a7613baee6
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
1 changed files with 13 additions and 1 deletions

View File

@ -2015,6 +2015,19 @@ class ApiV1Controller extends Controller
} }
$res = collect($feed) $res = collect($feed)
->filter(function($k) use($min, $max) {
if(!$min && !$max) {
return true;
}
if($min) {
return $min != $k;
}
if($max) {
return $max != $k;
}
})
->map(function($k) use($user) { ->map(function($k) use($user) {
$status = StatusService::getMastodon($k); $status = StatusService::getMastodon($k);
if(!$status || !isset($status['account']) || !isset($status['account']['id'])) { if(!$status || !isset($status['account']) || !isset($status['account']['id'])) {
@ -2032,7 +2045,6 @@ class ApiV1Controller extends Controller
}) })
->take($limit) ->take($limit)
->values(); ->values();
// ->toArray();
$baseUrl = config('app.url') . '/api/v1/timelines/public?limit=' . $limit . '&'; $baseUrl = config('app.url') . '/api/v1/timelines/public?limit=' . $limit . '&';
if($remote) { if($remote) {