Improved profile

This commit is contained in:
2017-07-03 17:21:00 +02:00
parent e6d18f2e1d
commit dd974ed99a
14 changed files with 180 additions and 92 deletions

View File

@ -6,19 +6,20 @@ import (
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils"
)
// GetThreadsByUser shows all forum threads of a particular user.
func GetThreadsByUser(ctx *aero.Context) string {
nick := ctx.Get("nick")
user, err := arn.GetUserByNick(nick)
viewUser, err := arn.GetUserByNick(nick)
if err != nil {
return ctx.Error(http.StatusNotFound, "User not found", err)
}
threads := user.Threads()
threads := viewUser.Threads()
arn.SortThreadsLatestFirst(threads)
return ctx.HTML(components.ThreadList(threads))
return ctx.HTML(components.ProfileThreads(threads, viewUser, utils.GetUser(ctx)))
}