mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02: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:
@@ -74,21 +74,8 @@ func (p *Processor) StatusesGet(
|
||||
return nil, gtserror.NewErrorInternalError(err)
|
||||
}
|
||||
|
||||
if len(statuses) == 0 {
|
||||
return util.EmptyPageableResponse(), nil
|
||||
}
|
||||
|
||||
// Filtering + serialization process is the same for
|
||||
// both pinned status queries and 'normal' ones.
|
||||
filtered, err := p.filter.StatusesVisible(ctx, requestingAccount, statuses)
|
||||
if err != nil {
|
||||
return nil, gtserror.NewErrorInternalError(err)
|
||||
}
|
||||
|
||||
count := len(filtered)
|
||||
count := len(statuses)
|
||||
if count == 0 {
|
||||
// After filtering there were
|
||||
// no statuses left to serve.
|
||||
return util.EmptyPageableResponse(), nil
|
||||
}
|
||||
|
||||
@@ -97,10 +84,17 @@ func (p *Processor) StatusesGet(
|
||||
|
||||
// Set next + prev values before filtering and API
|
||||
// converting, so caller can still page properly.
|
||||
nextMaxIDValue = filtered[count-1].ID
|
||||
prevMinIDValue = filtered[0].ID
|
||||
nextMaxIDValue = statuses[count-1].ID
|
||||
prevMinIDValue = statuses[0].ID
|
||||
)
|
||||
|
||||
// Filtering + serialization process is the same for
|
||||
// both pinned status queries and 'normal' ones.
|
||||
filtered, err := p.filter.StatusesVisible(ctx, requestingAccount, statuses)
|
||||
if err != nil {
|
||||
return nil, gtserror.NewErrorInternalError(err)
|
||||
}
|
||||
|
||||
for _, s := range filtered {
|
||||
// Convert filtered statuses to API statuses.
|
||||
item, err := p.converter.StatusToAPIStatus(ctx, s, requestingAccount)
|
||||
|
Reference in New Issue
Block a user