Forum activity shown in user profiles
This commit is contained in:
@ -4,16 +4,28 @@ import (
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
)
|
||||
|
||||
const maxPosts = 5
|
||||
|
||||
// Get ...
|
||||
func Get(ctx *aero.Context) string {
|
||||
nick := ctx.Get("nick")
|
||||
user, err := arn.GetUserByNick(nick)
|
||||
viewUser, err := arn.GetUserByNick(nick)
|
||||
user := utils.GetUser(ctx)
|
||||
|
||||
if err != nil {
|
||||
return ctx.Error(404, "User not found", err)
|
||||
}
|
||||
|
||||
return ctx.HTML(components.Profile(user, nil))
|
||||
threads := viewUser.Threads()
|
||||
|
||||
arn.SortThreadsByDate(threads)
|
||||
|
||||
if len(threads) > maxPosts {
|
||||
threads = threads[:maxPosts]
|
||||
}
|
||||
|
||||
return ctx.HTML(components.Profile(viewUser, user, threads))
|
||||
}
|
||||
|
Reference in New Issue
Block a user