mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-11-22 11:46:40 +00:00
stop paged endpoints returning null for empty items (#2597)
This commit is contained in:
parent
b614d33c40
commit
c13eb87ae7
|
@ -151,6 +151,11 @@ func (p *Processor) BlocksGet(
|
||||||
return util.EmptyPageableResponse(), nil
|
return util.EmptyPageableResponse(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get the lowest and highest
|
||||||
|
// ID values, used for paging.
|
||||||
|
lo := blocks[count-1].ID
|
||||||
|
hi := blocks[0].ID
|
||||||
|
|
||||||
items := make([]interface{}, 0, count)
|
items := make([]interface{}, 0, count)
|
||||||
|
|
||||||
for _, block := range blocks {
|
for _, block := range blocks {
|
||||||
|
@ -165,11 +170,6 @@ func (p *Processor) BlocksGet(
|
||||||
items = append(items, account)
|
items = append(items, account)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the lowest and highest
|
|
||||||
// ID values, used for paging.
|
|
||||||
lo := blocks[count-1].ID
|
|
||||||
hi := blocks[0].ID
|
|
||||||
|
|
||||||
return paging.PackageResponse(paging.ResponseParams{
|
return paging.PackageResponse(paging.ResponseParams{
|
||||||
Items: items,
|
Items: items,
|
||||||
Path: "/api/v1/blocks",
|
Path: "/api/v1/blocks",
|
||||||
|
|
|
@ -201,9 +201,6 @@ func (p *Processor) GetVisibleAPIAccountsPaged(
|
||||||
length int,
|
length int,
|
||||||
) []interface{} {
|
) []interface{} {
|
||||||
accounts := p.getVisibleAPIAccounts(ctx, 3, requester, next, length)
|
accounts := p.getVisibleAPIAccounts(ctx, 3, requester, next, length)
|
||||||
if len(accounts) == 0 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
items := make([]interface{}, len(accounts))
|
items := make([]interface{}, len(accounts))
|
||||||
for i, account := range accounts {
|
for i, account := range accounts {
|
||||||
items[i] = account
|
items[i] = account
|
||||||
|
|
Loading…
Reference in a new issue