summaryrefslogtreecommitdiff
path: root/internal/web/profile.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2022-06-08 20:22:49 +0200
committerLibravatar GitHub <noreply@github.com>2022-06-08 20:22:49 +0200
commit6f6e89e2715c9ecbadda6b8dbe5227995348dae8 (patch)
treeda867633cdd72981460baf76615a81ab3390ce9c /internal/web/profile.go
parent[frontend] linkify header mascot+title (#633) (diff)
downloadgotosocial-6f6e89e2715c9ecbadda6b8dbe5227995348dae8.tar.xz
[feature] Add paging via `Link` header for notifications and account statuses (#629)
* test link headers * page get account statuses properly * page get notifications * add util func for packaging timeline responses * return timelined stuff from accountstatusesget * rename timeline response * use new convenience function * go fmt
Diffstat (limited to 'internal/web/profile.go')
-rw-r--r--internal/web/profile.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/internal/web/profile.go b/internal/web/profile.go
index 66419dcc7..3155c022d 100644
--- a/internal/web/profile.go
+++ b/internal/web/profile.go
@@ -29,6 +29,7 @@ import (
"github.com/sirupsen/logrus"
"github.com/superseriousbusiness/gotosocial/internal/ap"
"github.com/superseriousbusiness/gotosocial/internal/api"
+ apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model"
"github.com/superseriousbusiness/gotosocial/internal/config"
"github.com/superseriousbusiness/gotosocial/internal/oauth"
)
@@ -79,7 +80,7 @@ func (m *Module) profileTemplateHandler(c *gin.Context) {
// get latest 10 top-level public statuses;
// ie., exclude replies and boosts, public only,
// with or without media
- statuses, errWithCode := m.processor.AccountStatusesGet(ctx, authed, account.ID, 10, true, true, "", "", false, false, true)
+ statusResp, errWithCode := m.processor.AccountStatusesGet(ctx, authed, account.ID, 10, true, true, "", "", false, false, true)
if errWithCode != nil {
l.Debugf("error getting statuses from processor: %s", errWithCode.Error())
c.JSON(errWithCode.Code(), gin.H{"error": errWithCode.Safe()})
@@ -92,7 +93,11 @@ func (m *Module) profileTemplateHandler(c *gin.Context) {
randomIndex := rand.Intn(len(m.defaultAvatars))
dummyAvatar := m.defaultAvatars[randomIndex]
account.Avatar = dummyAvatar
- for _, s := range statuses {
+ for _, i := range statusResp.Items {
+ s, ok := i.(*apimodel.Status)
+ if !ok {
+ panic("timelineable was not *apimodel.Status")
+ }
s.Account.Avatar = dummyAvatar
}
}
@@ -100,7 +105,7 @@ func (m *Module) profileTemplateHandler(c *gin.Context) {
c.HTML(http.StatusOK, "profile.tmpl", gin.H{
"instance": instance,
"account": account,
- "statuses": statuses,
+ "statuses": statusResp.Items,
"stylesheets": []string{
"/assets/Fork-Awesome/css/fork-awesome.min.css",
"/assets/status.css",