diff options
author | r <r@freesoftwareextremist.com> | 2019-12-20 18:30:20 +0000 |
---|---|---|
committer | r <r@freesoftwareextremist.com> | 2019-12-20 18:30:20 +0000 |
commit | a1f49af1d93bccdd56d4538b149884418bd2ca2c (patch) | |
tree | add621fe17d9dbcf3625bcc7de1738ea8c89bc9f /renderer | |
parent | 3d1e4cfa4c17eea9a64b8672df769c540fefdaeb (diff) | |
download | bloat-a1f49af1d93bccdd56d4538b149884418bd2ca2c.tar.gz bloat-a1f49af1d93bccdd56d4538b149884418bd2ca2c.zip |
Add user page and follow/unfollow calls
Diffstat (limited to 'renderer')
-rw-r--r-- | renderer/model.go | 18 | ||||
-rw-r--r-- | renderer/renderer.go | 5 |
2 files changed, 23 insertions, 0 deletions
diff --git a/renderer/model.go b/renderer/model.go index ad356e2..7e52850 100644 --- a/renderer/model.go +++ b/renderer/model.go @@ -68,3 +68,21 @@ func NewNotificationPageTemplateData(notifications []*mastodon.Notification, has NavbarData: navbarData, } } + +type UserPageTemplateData struct { + User *mastodon.Account + Statuses []*mastodon.Status + HasNext bool + NextLink string + NavbarData *NavbarTemplateData +} + +func NewUserPageTemplateData(user *mastodon.Account, statuses []*mastodon.Status, hasNext bool, nextLink string, navbarData *NavbarTemplateData) *UserPageTemplateData { + return &UserPageTemplateData{ + User: user, + Statuses: statuses, + HasNext: hasNext, + NextLink: nextLink, + NavbarData: navbarData, + } +} diff --git a/renderer/renderer.go b/renderer/renderer.go index 394d74f..890006b 100644 --- a/renderer/renderer.go +++ b/renderer/renderer.go @@ -18,6 +18,7 @@ type Renderer interface { RenderTimelinePage(ctx context.Context, writer io.Writer, data *TimelinePageTemplateData) (err error) RenderThreadPage(ctx context.Context, writer io.Writer, data *ThreadPageTemplateData) (err error) RenderNotificationPage(ctx context.Context, writer io.Writer, data *NotificationPageTemplateData) (err error) + RenderUserPage(ctx context.Context, writer io.Writer, data *UserPageTemplateData) (err error) } type renderer struct { @@ -65,6 +66,10 @@ func (r *renderer) RenderNotificationPage(ctx context.Context, writer io.Writer, return r.template.ExecuteTemplate(writer, "notification.tmpl", data) } +func (r *renderer) RenderUserPage(ctx context.Context, writer io.Writer, data *UserPageTemplateData) (err error) { + return r.template.ExecuteTemplate(writer, "user.tmpl", data) +} + func WithEmojis(content string, emojis []mastodon.Emoji) string { var emojiNameContentPair []string for _, e := range emojis { |