Skip to content

Commit

Permalink
Update ApiV1Controller, fix public timeline min/max id pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
dansup committed Jun 15, 2022
1 parent 154f234 commit a7613ba
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion app/Http/Controllers/Api/ApiV1Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -2015,6 +2015,19 @@ public function timelinePublic(Request $request)
}

$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) {
$status = StatusService::getMastodon($k);
if(!$status || !isset($status['account']) || !isset($status['account']['id'])) {
Expand All @@ -2032,7 +2045,6 @@ public function timelinePublic(Request $request)
})
->take($limit)
->values();
// ->toArray();

$baseUrl = config('app.url') . '/api/v1/timelines/public?limit=' . $limit . '&';
if($remote) {
Expand Down

0 comments on commit a7613ba

Please sign in to comment.