mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 19:42:25 -05:00
[bugfix] Fix paging for empty items (#2236)
* use minID properly for public timeline * return paged response properly even when 0 items * use gtserror * page more consistently (for now) * test * aaa
This commit is contained in:
parent
736cd37caf
commit
2b6b9cdf83
7 changed files with 75 additions and 62 deletions
|
|
@ -118,6 +118,7 @@ func (suite *PagingSuite) TestPagingNoItems() {
|
|||
config.SetHost("example.org")
|
||||
|
||||
params := util.PageableResponseParams{
|
||||
Path: "/api/v1/accounts/01H11KA68PM4NNYJEG0FJQ90R3/statuses",
|
||||
NextMaxIDValue: "01H11KA1DM2VH3747YDE7FV5HN",
|
||||
PrevMinIDValue: "01H11KBBVRRDYYC5KEPME1NP5R",
|
||||
Limit: 10,
|
||||
|
|
@ -129,9 +130,9 @@ func (suite *PagingSuite) TestPagingNoItems() {
|
|||
}
|
||||
|
||||
suite.Empty(resp.Items)
|
||||
suite.Empty(resp.LinkHeader)
|
||||
suite.Empty(resp.NextLink)
|
||||
suite.Empty(resp.PrevLink)
|
||||
suite.Equal(`<https://example.org/api/v1/accounts/01H11KA68PM4NNYJEG0FJQ90R3/statuses?limit=10&max_id=01H11KA1DM2VH3747YDE7FV5HN>; rel="next", <https://example.org/api/v1/accounts/01H11KA68PM4NNYJEG0FJQ90R3/statuses?limit=10&min_id=01H11KBBVRRDYYC5KEPME1NP5R>; rel="prev"`, resp.LinkHeader)
|
||||
suite.Equal(`https://example.org/api/v1/accounts/01H11KA68PM4NNYJEG0FJQ90R3/statuses?limit=10&max_id=01H11KA1DM2VH3747YDE7FV5HN`, resp.NextLink)
|
||||
suite.Equal(`https://example.org/api/v1/accounts/01H11KA68PM4NNYJEG0FJQ90R3/statuses?limit=10&min_id=01H11KBBVRRDYYC5KEPME1NP5R`, resp.PrevLink)
|
||||
}
|
||||
|
||||
func TestPagingSuite(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue