Upgraded to latest aero version
This commit is contained in:
@ -10,7 +10,7 @@ package profile
|
||||
// )
|
||||
|
||||
// // GetFollowers shows the followers of a particular user.
|
||||
// func GetFollowers(ctx *aero.Context) string {
|
||||
// func GetFollowers(ctx aero.Context) error {
|
||||
// nick := ctx.Get("nick")
|
||||
// viewUser, err := arn.GetUserByNick(nick)
|
||||
|
||||
@ -21,6 +21,6 @@ package profile
|
||||
// followers := viewUser.Followers()
|
||||
// arn.SortUsersLastSeenFirst(followers)
|
||||
|
||||
// return ctx.HTML(components.ProfileFollowers(followers, viewUser, utils.GetUser(ctx), ctx.URI()))
|
||||
// return ctx.HTML(components.ProfileFollowers(followers, viewUser, utils.GetUser(ctx), ctx.Path()))
|
||||
|
||||
// }
|
||||
|
@ -12,7 +12,7 @@ package profile
|
||||
// const postLimit = 10
|
||||
|
||||
// // GetPostsByUser shows all forum posts of a particular user.
|
||||
// func GetPostsByUser(ctx *aero.Context) string {
|
||||
// func GetPostsByUser(ctx aero.Context) error {
|
||||
// nick := ctx.Get("nick")
|
||||
// viewUser, err := arn.GetUserByNick(nick)
|
||||
|
||||
@ -27,6 +27,6 @@ package profile
|
||||
// posts = posts[:postLimit]
|
||||
// }
|
||||
|
||||
// return ctx.HTML(components.LatestPosts(arn.ToPostables(posts), viewUser, utils.GetUser(ctx), ctx.URI()))
|
||||
// return ctx.HTML(components.LatestPosts(arn.ToPostables(posts), viewUser, utils.GetUser(ctx), ctx.Path()))
|
||||
|
||||
// }
|
||||
|
@ -6,7 +6,9 @@ import (
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/notify.moe/assets"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
"github.com/animenotifier/notify.moe/middleware"
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
)
|
||||
|
||||
@ -17,7 +19,7 @@ const (
|
||||
)
|
||||
|
||||
// Get user profile page.
|
||||
func Get(ctx *aero.Context) string {
|
||||
func Get(ctx aero.Context) error {
|
||||
nick := ctx.Get("nick")
|
||||
viewUser, err := arn.GetUserByNick(nick)
|
||||
|
||||
@ -29,7 +31,7 @@ func Get(ctx *aero.Context) string {
|
||||
}
|
||||
|
||||
// Profile renders the user profile page of the given viewUser.
|
||||
func Profile(ctx *aero.Context, viewUser *arn.User) string {
|
||||
func Profile(ctx aero.Context, viewUser *arn.User) error {
|
||||
user := utils.GetUser(ctx)
|
||||
|
||||
// Anime list
|
||||
@ -99,7 +101,7 @@ func Profile(ctx *aero.Context, viewUser *arn.User) string {
|
||||
Tags: map[string]string{
|
||||
"og:title": viewUser.Nick,
|
||||
"og:image": viewUser.AvatarLink("large"),
|
||||
"og:url": "https://" + ctx.App.Config.Domain + viewUser.Link(),
|
||||
"og:url": "https://" + assets.Domain + viewUser.Link(),
|
||||
"og:site_name": "notify.moe",
|
||||
"og:description": utils.CutLongDescription(viewUser.Introduction),
|
||||
"og:type": "profile",
|
||||
@ -177,7 +179,8 @@ func Profile(ctx *aero.Context, viewUser *arn.User) string {
|
||||
characters = characters[:maxCharacters]
|
||||
}
|
||||
|
||||
ctx.Data = openGraph
|
||||
customCtx := ctx.(*middleware.OpenGraphContext)
|
||||
customCtx.OpenGraph = openGraph
|
||||
|
||||
return ctx.HTML(components.Profile(
|
||||
viewUser,
|
||||
@ -190,6 +193,6 @@ func Profile(ctx *aero.Context, viewUser *arn.User) string {
|
||||
topStudios,
|
||||
animeWatchingTime,
|
||||
dayToActivityCount,
|
||||
ctx.URI(),
|
||||
ctx.Path(),
|
||||
))
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
// Liked shows all liked characters of a particular user.
|
||||
func Liked(ctx *aero.Context) string {
|
||||
func Liked(ctx aero.Context) error {
|
||||
nick := ctx.Get("nick")
|
||||
viewUser, err := arn.GetUserByNick(nick)
|
||||
|
||||
@ -40,5 +40,5 @@ func Liked(ctx *aero.Context) string {
|
||||
// return aLikes > bLikes
|
||||
})
|
||||
|
||||
return ctx.HTML(components.ProfileCharacters(characters, viewUser, utils.GetUser(ctx), ctx.URI()))
|
||||
return ctx.HTML(components.ProfileCharacters(characters, viewUser, utils.GetUser(ctx), ctx.Path()))
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ package profilequotes
|
||||
// )
|
||||
|
||||
// // Added shows all quotes added by a particular user.
|
||||
// func Added(ctx *aero.Context) string {
|
||||
// func Added(ctx aero.Context) error {
|
||||
// return render(ctx, addedQuotes)
|
||||
// }
|
||||
|
||||
|
@ -6,7 +6,7 @@ package profilequotes
|
||||
// )
|
||||
|
||||
// // Liked shows all quotes liked by a particular user.
|
||||
// func Liked(ctx *aero.Context) string {
|
||||
// func Liked(ctx aero.Context) error {
|
||||
// return render(ctx, likedQuotes)
|
||||
// }
|
||||
|
||||
|
@ -16,7 +16,7 @@ package profilequotes
|
||||
// )
|
||||
|
||||
// // render renders the quotes on user profiles.
|
||||
// func render(ctx *aero.Context, fetch func(userID string) []*arn.Quote) string {
|
||||
// func render(ctx aero.Context, fetch func(userID string) []*arn.Quote) string {
|
||||
// nick := ctx.Get("nick")
|
||||
// index, _ := ctx.GetInt("index")
|
||||
// user := utils.GetUser(ctx)
|
||||
@ -53,5 +53,5 @@ package profilequotes
|
||||
// }
|
||||
|
||||
// // Otherwise, send the full page
|
||||
// return ctx.HTML(components.ProfileQuotes(quotes, viewUser, nextIndex, user, ctx.URI()))
|
||||
// return ctx.HTML(components.ProfileQuotes(quotes, viewUser, nextIndex, user, ctx.Path()))
|
||||
// }
|
||||
|
@ -6,7 +6,7 @@ package profiletracks
|
||||
// )
|
||||
|
||||
// // Added shows all soundtracks added by a particular user.
|
||||
// func Added(ctx *aero.Context) string {
|
||||
// func Added(ctx aero.Context) error {
|
||||
// return render(ctx, addedTracks)
|
||||
// }
|
||||
|
||||
|
@ -6,7 +6,7 @@ package profiletracks
|
||||
// )
|
||||
|
||||
// // Liked shows all soundtracks liked by a particular user.
|
||||
// func Liked(ctx *aero.Context) string {
|
||||
// func Liked(ctx aero.Context) error {
|
||||
// return render(ctx, likedTracks)
|
||||
// }
|
||||
|
||||
|
@ -16,7 +16,7 @@ package profiletracks
|
||||
// )
|
||||
|
||||
// // render renders the soundtracks on user profiles.
|
||||
// func render(ctx *aero.Context, fetch func(userID string) []*arn.SoundTrack) string {
|
||||
// func render(ctx aero.Context, fetch func(userID string) []*arn.SoundTrack) string {
|
||||
// nick := ctx.Get("nick")
|
||||
// index, _ := ctx.GetInt("index")
|
||||
// user := utils.GetUser(ctx)
|
||||
@ -53,5 +53,5 @@ package profiletracks
|
||||
// }
|
||||
|
||||
// // Otherwise, send the full page
|
||||
// return ctx.HTML(components.ProfileSoundTracks(tracks, viewUser, nextIndex, user, ctx.URI()))
|
||||
// return ctx.HTML(components.ProfileSoundTracks(tracks, viewUser, nextIndex, user, ctx.Path()))
|
||||
// }
|
||||
|
@ -15,7 +15,7 @@ package profile
|
||||
// type stats map[string]float64
|
||||
|
||||
// // GetStatsByUser shows statistics for a given user.
|
||||
// func GetStatsByUser(ctx *aero.Context) string {
|
||||
// func GetStatsByUser(ctx aero.Context) error {
|
||||
// nick := ctx.Get("nick")
|
||||
// viewUser, err := arn.GetUserByNick(nick)
|
||||
// userStats := utils.UserStats{}
|
||||
@ -98,5 +98,5 @@ package profile
|
||||
// arn.NewPieChart("Soundtracks", trackTags),
|
||||
// }
|
||||
|
||||
// return ctx.HTML(components.ProfileStats(&userStats, viewUser, utils.GetUser(ctx), ctx.URI()))
|
||||
// return ctx.HTML(components.ProfileStats(&userStats, viewUser, utils.GetUser(ctx), ctx.Path()))
|
||||
// }
|
||||
|
@ -12,7 +12,7 @@ package profile
|
||||
// const maxThreads = 20
|
||||
|
||||
// // GetThreadsByUser shows all forum threads of a particular user.
|
||||
// func GetThreadsByUser(ctx *aero.Context) string {
|
||||
// func GetThreadsByUser(ctx aero.Context) error {
|
||||
// nick := ctx.Get("nick")
|
||||
// viewUser, err := arn.GetUserByNick(nick)
|
||||
|
||||
@ -27,5 +27,5 @@ package profile
|
||||
// threads = threads[:maxThreads]
|
||||
// }
|
||||
|
||||
// return ctx.HTML(components.ProfileThreads(threads, viewUser, utils.GetUser(ctx), ctx.URI()))
|
||||
// return ctx.HTML(components.ProfileThreads(threads, viewUser, utils.GetUser(ctx), ctx.Path()))
|
||||
// }
|
||||
|
Reference in New Issue
Block a user