Skip to content

Commit

Permalink
Update ApiV1Controller, fix pagination header. Fixes #3354
Browse files Browse the repository at this point in the history
  • Loading branch information
dansup committed Sep 19, 2022
1 parent 49ceed7 commit 4fe07e6
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions app/Http/Controllers/Api/ApiV1Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -1897,15 +1897,15 @@ public function accountNotifications(Request $request)
}

if($maxId) {
$link = '<'.$baseUrl.'max_id='.$maxId.'>; rel="next"';
$link = '<'.$baseUrl.'max_id='.$minId.'>; rel="next"';
}

if($minId) {
$link = '<'.$baseUrl.'min_id='.$minId.'>; rel="prev"';
$link = '<'.$baseUrl.'min_id='.$maxId.'>; rel="prev"';
}

if($maxId && $minId) {
$link = '<'.$baseUrl.'max_id='.$maxId.'>; rel="next",<'.$baseUrl.'min_id='.$minId.'>; rel="prev"';
$link = '<'.$baseUrl.'max_id='.$minId.'>; rel="next",<'.$baseUrl.'min_id='.$maxId.'>; rel="prev"';
}

$headers = isset($link) ? ['Link' => $link] : [];
Expand Down Expand Up @@ -2019,15 +2019,15 @@ public function timelineHome(Request $request)
}

if($maxId) {
$link = '<'.$baseUrl.'max_id='.$maxId.'>; rel="next"';
$link = '<'.$baseUrl.'max_id='.$minId.'>; rel="next"';
}

if($minId) {
$link = '<'.$baseUrl.'min_id='.$minId.'>; rel="prev"';
$link = '<'.$baseUrl.'min_id='.$maxId.'>; rel="prev"';
}

if($maxId && $minId) {
$link = '<'.$baseUrl.'max_id='.$maxId.'>; rel="next",<'.$baseUrl.'min_id='.$minId.'>; rel="prev"';
$link = '<'.$baseUrl.'max_id='.$minId.'>; rel="next",<'.$baseUrl.'min_id='.$maxId.'>; rel="prev"';
}

$headers = isset($link) ? ['Link' => $link] : [];
Expand Down Expand Up @@ -2136,15 +2136,15 @@ public function timelinePublic(Request $request)
}

if($maxId) {
$link = '<'.$baseUrl.'max_id='.$maxId.'>; rel="next"';
$link = '<'.$baseUrl.'max_id='.$minId.'>; rel="next"';
}

if($minId) {
$link = '<'.$baseUrl.'min_id='.$minId.'>; rel="prev"';
$link = '<'.$baseUrl.'min_id='.$maxId.'>; rel="prev"';
}

if($maxId && $minId) {
$link = '<'.$baseUrl.'max_id='.$maxId.'>; rel="next",<'.$baseUrl.'min_id='.$minId.'>; rel="prev"';
$link = '<'.$baseUrl.'max_id='.$minId.'>; rel="next",<'.$baseUrl.'min_id='.$maxId.'>; rel="prev"';
}

$headers = isset($link) ? ['Link' => $link] : [];
Expand Down

0 comments on commit 4fe07e6

Please sign in to comment.