mirror of
https://gitea.phreedom.club/localhost_frssoft/bloat.git
synced 2025-05-03 18:38:46 +00:00
Add user page and follow/unfollow calls
This commit is contained in:
parent
3d1e4cfa4c
commit
a1f49af1d9
11 changed files with 310 additions and 33 deletions
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue