From 7033cdcd6b4a8f1e33edd332ba1799a68a6a1871 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 1 Feb 2020 21:38:25 -0500 Subject: [PATCH] Remove next link when there aren't any introductions in Module\Api\Mastodon\FollowRequests --- src/Module/Api/Mastodon/FollowRequests.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Module/Api/Mastodon/FollowRequests.php b/src/Module/Api/Mastodon/FollowRequests.php index 3b2de61bcc..169250f11c 100644 --- a/src/Module/Api/Mastodon/FollowRequests.php +++ b/src/Module/Api/Mastodon/FollowRequests.php @@ -106,7 +106,10 @@ class FollowRequests extends BaseApi if ($introductions->getTotalCount() > $limit) { $links[] = '<' . $baseUrl->get() . '/api/v1/follow_requests?' . http_build_query($base_query + ['max_id' => $introductions[count($introductions) - 1]->id]) . '>; rel="next"'; } - $links[] = '<' . $baseUrl->get() . '/api/v1/follow_requests?' . http_build_query($base_query + ['since_id' => $introductions[0]->id]) . '>; rel="prev"'; + + if (count($introductions)) { + $links[] = '<' . $baseUrl->get() . '/api/v1/follow_requests?' . http_build_query($base_query + ['since_id' => $introductions[0]->id]) . '>; rel="prev"'; + } header('Link: ' . implode(', ', $links));