summaryrefslogtreecommitdiff
path: root/internal/processing/account/statuses.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2023-07-18 09:43:17 +0100
committerLibravatar GitHub <noreply@github.com>2023-07-18 09:43:17 +0100
commitf4319740ab02d680961781861335285f618f5f48 (patch)
tree133595a10ec93cce9da269a4fa671c226bab7298 /internal/processing/account/statuses.go
parent[bugfix] Add missing `continue` statement in `prepareXBetweenIDs` (#1996) (diff)
downloadgotosocial-f4319740ab02d680961781861335285f618f5f48.tar.xz
[bugfix] more robust list timeline invalidation (#1995)v0.10.0-rc3
Diffstat (limited to 'internal/processing/account/statuses.go')
-rw-r--r--internal/processing/account/statuses.go36
1 files changed, 13 insertions, 23 deletions
diff --git a/internal/processing/account/statuses.go b/internal/processing/account/statuses.go
index df7064b79..26684265c 100644
--- a/internal/processing/account/statuses.go
+++ b/internal/processing/account/statuses.go
@@ -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)
}