From a8254a40e71cd2b38b488c40490b1e7736c5ca6d Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Tue, 30 Apr 2024 15:22:23 +0100 Subject: [bugfix] further paging mishaps (#2884) * FURTHER paging shenanigans :smiling_face_with_tear: * remove cursor logic from ToLinkURL() * fix up paging tests --------- Co-authored-by: tobi --- internal/paging/boundary.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'internal/paging/boundary.go') diff --git a/internal/paging/boundary.go b/internal/paging/boundary.go index bf4508aff..8a3187d7f 100644 --- a/internal/paging/boundary.go +++ b/internal/paging/boundary.go @@ -54,6 +54,13 @@ func EitherMinID(minID, sinceID string) Boundary { the cursor value, and max_id provides a limiting value to the results. + But to further complicate it... + + The "next" and "prev" relative links provided + in the link header are ALWAYS DESCENDING. Which + means we will ALWAYS provide next=?max_id and + prev=?min_id. *shakes fist at mastodon api* + */ switch { case minID != "": @@ -67,7 +74,12 @@ func EitherMinID(minID, sinceID string) Boundary { // SinceID ... func SinceID(sinceID string) Boundary { return Boundary{ - Name: "since_id", + // even when a since_id query is + // provided, the next / prev rel + // links are DESCENDING with + // next:max_id and prev:min_id. + // so ALWAYS use min_id as name. + Name: "min_id", Value: sinceID, Order: OrderDescending, } -- cgit v1.2.3