diff options
author | r <r@freesoftwareextremist.com> | 2019-12-25 04:39:34 +0000 |
---|---|---|
committer | r <r@freesoftwareextremist.com> | 2019-12-25 04:39:34 +0000 |
commit | c18a1be21a8952d9d5fe3ca05c866838337babd1 (patch) | |
tree | b50b263f99ab9d163a67b7531464cc191d3140b3 /service | |
parent | 1939d120cd1b022d4ba8dff5c4006e2fb8e14e62 (diff) | |
download | bloat-c18a1be21a8952d9d5fe3ca05c866838337babd1.tar.gz bloat-c18a1be21a8952d9d5fe3ca05c866838337babd1.zip |
Fix timeline pagination
Diffstat (limited to 'service')
-rw-r--r-- | service/service.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/service/service.go b/service/service.go index 7fc27fc..ffd850c 100644 --- a/service/service.go +++ b/service/service.go @@ -5,6 +5,7 @@ import ( "context" "encoding/json" "errors" + "fmt" "io" "mime/multipart" "net/http" @@ -243,7 +244,7 @@ func (svc *service) ServeTimelinePage(ctx context.Context, client io.Writer, if len(maxID) > 0 && len(statuses) > 0 { hasPrev = true - prevLink = "/timeline?min_id=" + statuses[0].ID + prevLink = fmt.Sprintf("/timeline/$s?min_id=%s", timelineType, statuses[0].ID) } if len(minID) > 0 && len(pg.MinID) > 0 { newStatuses, err := c.GetTimelineHome(ctx, &mastodon.Pagination{MinID: pg.MinID, Limit: 20}) @@ -253,18 +254,18 @@ func (svc *service) ServeTimelinePage(ctx context.Context, client io.Writer, newStatusesLen := len(newStatuses) if newStatusesLen == 20 { hasPrev = true - prevLink = "/timeline?min_id=" + pg.MinID + prevLink = fmt.Sprintf("/timeline/%s?min_id=%s", timelineType, pg.MinID) } else { i := 20 - newStatusesLen - 1 if len(statuses) > i { hasPrev = true - prevLink = "/timeline?min_id=" + statuses[i].ID + prevLink = fmt.Sprintf("/timeline/%s?min_id=%s", timelineType, statuses[i].ID) } } } if len(pg.MaxID) > 0 { hasNext = true - nextLink = "/timeline?max_id=" + pg.MaxID + nextLink = fmt.Sprintf("/timeline/%s?max_id=%s", timelineType, pg.MaxID) } postContext := model.PostContext{ |