summaryrefslogtreecommitdiff
path: root/internal/processing/timeline
diff options
context:
space:
mode:
Diffstat (limited to 'internal/processing/timeline')
-rw-r--r--internal/processing/timeline/faved.go6
-rw-r--r--internal/processing/timeline/home.go18
-rw-r--r--internal/processing/timeline/list.go18
-rw-r--r--internal/processing/timeline/public.go23
4 files changed, 21 insertions, 44 deletions
diff --git a/internal/processing/timeline/faved.go b/internal/processing/timeline/faved.go
index 0fc92d8fa..556ced4c3 100644
--- a/internal/processing/timeline/faved.go
+++ b/internal/processing/timeline/faved.go
@@ -46,7 +46,7 @@ func (p *Processor) FavedTimelineGet(ctx context.Context, authed *oauth.Auth, ma
for _, s := range statuses {
visible, err := p.filter.StatusVisible(ctx, authed.Account, s)
if err != nil {
- log.Debugf(ctx, "skipping status %s because of an error checking status visibility: %s", s.ID, err)
+ log.Errorf(ctx, "error checking status visibility: %v", err)
continue
}
@@ -56,7 +56,7 @@ func (p *Processor) FavedTimelineGet(ctx context.Context, authed *oauth.Auth, ma
apiStatus, err := p.tc.StatusToAPIStatus(ctx, s, authed.Account)
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
}
@@ -65,7 +65,7 @@ func (p *Processor) FavedTimelineGet(ctx context.Context, authed *oauth.Auth, ma
return util.PackagePageableResponse(util.PageableResponseParams{
Items: items,
- Path: "api/v1/favourites",
+ Path: "/api/v1/favourites",
NextMaxIDValue: nextMaxID,
PrevMinIDValue: prevMinID,
Limit: limit,
diff --git a/internal/processing/timeline/home.go b/internal/processing/timeline/home.go
index 807189495..72940175f 100644
--- a/internal/processing/timeline/home.go
+++ b/internal/processing/timeline/home.go
@@ -116,25 +116,17 @@ func (p *Processor) HomeTimelineGet(ctx context.Context, authed *oauth.Auth, max
var (
items = make([]interface{}, count)
- nextMaxIDValue string
- prevMinIDValue string
+ nextMaxIDValue = statuses[count-1].GetID()
+ prevMinIDValue = statuses[0].GetID()
)
- for i, item := range statuses {
- if i == count-1 {
- nextMaxIDValue = item.GetID()
- }
-
- if i == 0 {
- prevMinIDValue = item.GetID()
- }
-
- items[i] = item
+ for i := range statuses {
+ items[i] = statuses[i]
}
return util.PackagePageableResponse(util.PageableResponseParams{
Items: items,
- Path: "api/v1/timelines/home",
+ Path: "/api/v1/timelines/home",
NextMaxIDValue: nextMaxIDValue,
PrevMinIDValue: prevMinIDValue,
Limit: limit,
diff --git a/internal/processing/timeline/list.go b/internal/processing/timeline/list.go
index 830c874a9..80744df15 100644
--- a/internal/processing/timeline/list.go
+++ b/internal/processing/timeline/list.go
@@ -142,25 +142,17 @@ func (p *Processor) ListTimelineGet(ctx context.Context, authed *oauth.Auth, lis
var (
items = make([]interface{}, count)
- nextMaxIDValue string
- prevMinIDValue string
+ nextMaxIDValue = statuses[count-1].GetID()
+ prevMinIDValue = statuses[0].GetID()
)
- for i, item := range statuses {
- if i == count-1 {
- nextMaxIDValue = item.GetID()
- }
-
- if i == 0 {
- prevMinIDValue = item.GetID()
- }
-
- items[i] = item
+ for i := range statuses {
+ items[i] = statuses[i]
}
return util.PackagePageableResponse(util.PageableResponseParams{
Items: items,
- Path: "api/v1/timelines/list/" + listID,
+ Path: "/api/v1/timelines/list/" + listID,
NextMaxIDValue: nextMaxIDValue,
PrevMinIDValue: prevMinIDValue,
Limit: limit,
diff --git a/internal/processing/timeline/public.go b/internal/processing/timeline/public.go
index 67893ecfa..78ca56734 100644
--- a/internal/processing/timeline/public.go
+++ b/internal/processing/timeline/public.go
@@ -43,25 +43,18 @@ func (p *Processor) PublicTimelineGet(ctx context.Context, authed *oauth.Auth, m
}
var (
- items = make([]interface{}, 0, count)
- nextMaxIDValue string
- prevMinIDValue string
- )
+ items = make([]interface{}, 0, count)
- for i, s := range statuses {
// 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 = statuses[count-1].ID
+ prevMinIDValue = statuses[0].ID
+ )
+ for _, s := range statuses {
timelineable, err := p.filter.StatusPublicTimelineable(ctx, authed.Account, s)
if err != nil {
- log.Debugf(ctx, "skipping status %s because of an error checking StatusPublicTimelineable: %s", s.ID, err)
+ log.Errorf(ctx, "error checking status visibility: %v", err)
continue
}
@@ -71,7 +64,7 @@ func (p *Processor) PublicTimelineGet(ctx context.Context, authed *oauth.Auth, m
apiStatus, err := p.tc.StatusToAPIStatus(ctx, s, authed.Account)
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 convert to api status: %v", err)
continue
}
@@ -80,7 +73,7 @@ func (p *Processor) PublicTimelineGet(ctx context.Context, authed *oauth.Auth, m
return util.PackagePageableResponse(util.PageableResponseParams{
Items: items,
- Path: "api/v1/timelines/public",
+ Path: "/api/v1/timelines/public",
NextMaxIDValue: nextMaxIDValue,
PrevMinIDValue: prevMinIDValue,
Limit: limit,