mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-16 21:47:34 -06:00
[bugfix] more robust list timeline invalidation (#1995)
This commit is contained in:
parent
346ecabd07
commit
f4319740ab
15 changed files with 254 additions and 226 deletions
|
|
@ -93,28 +93,21 @@ func (p *Processor) StatusesGet(
|
|||
}
|
||||
|
||||
var (
|
||||
items = make([]interface{}, 0, count)
|
||||
nextMaxIDValue string
|
||||
prevMinIDValue string
|
||||
)
|
||||
items = make([]interface{}, 0, count)
|
||||
|
||||
for i, s := range filtered {
|
||||
// Set next + prev values before filtering and API
|
||||
// converting, so caller can still page properly.
|
||||
if i == count-1 {
|
||||
nextMaxIDValue = s.ID
|
||||
}
|
||||
|
||||
if i == 0 {
|
||||
prevMinIDValue = s.ID
|
||||
}
|
||||
nextMaxIDValue = filtered[count-1].ID
|
||||
prevMinIDValue = filtered[0].ID
|
||||
)
|
||||
|
||||
for _, s := range filtered {
|
||||
// Convert filtered statuses to API statuses.
|
||||
item, err := p.tc.StatusToAPIStatus(ctx, s, requestingAccount)
|
||||
if err != nil {
|
||||
log.Debugf(ctx, "skipping status %s because it couldn't be converted to its api representation: %s", s.ID, err)
|
||||
log.Errorf(ctx, "error convering to api status: %v", err)
|
||||
continue
|
||||
}
|
||||
|
||||
items = append(items, item)
|
||||
}
|
||||
|
||||
|
|
@ -171,23 +164,20 @@ func (p *Processor) WebStatusesGet(ctx context.Context, targetAccountID string,
|
|||
}
|
||||
|
||||
var (
|
||||
items = make([]interface{}, 0, count)
|
||||
nextMaxIDValue string
|
||||
)
|
||||
items = make([]interface{}, 0, count)
|
||||
|
||||
for i, s := range statuses {
|
||||
// Set next value before API converting,
|
||||
// so caller can still page properly.
|
||||
if i == count-1 {
|
||||
nextMaxIDValue = s.ID
|
||||
}
|
||||
nextMaxIDValue = statuses[count-1].ID
|
||||
)
|
||||
|
||||
for _, s := range statuses {
|
||||
// Convert fetched statuses to API statuses.
|
||||
item, err := p.tc.StatusToAPIStatus(ctx, s, nil)
|
||||
if err != nil {
|
||||
log.Debugf(ctx, "skipping status %s because it couldn't be converted to its api representation: %s", s.ID, err)
|
||||
log.Errorf(ctx, "error convering to api status: %v", err)
|
||||
continue
|
||||
}
|
||||
|
||||
items = append(items, item)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue