2017-06-22 11:21:26 -03:00
|
|
|
package profile
|
|
|
|
|
2018-11-24 15:57:52 +09:00
|
|
|
// import (
|
|
|
|
// "net/http"
|
2017-06-22 11:21:26 -03:00
|
|
|
|
2018-11-24 15:57:52 +09:00
|
|
|
// "github.com/aerogo/aero"
|
2019-06-03 18:32:43 +09:00
|
|
|
// "github.com/animenotifier/notify.moe/arn"
|
2018-11-24 15:57:52 +09:00
|
|
|
// "github.com/animenotifier/notify.moe/components"
|
|
|
|
// "github.com/animenotifier/notify.moe/utils"
|
|
|
|
// )
|
2017-06-22 11:21:26 -03:00
|
|
|
|
2018-11-24 15:57:52 +09:00
|
|
|
// const postLimit = 10
|
2017-06-22 12:03:43 -03:00
|
|
|
|
2018-11-24 15:57:52 +09:00
|
|
|
// // GetPostsByUser shows all forum posts of a particular user.
|
2019-06-01 13:55:49 +09:00
|
|
|
// func GetPostsByUser(ctx aero.Context) error {
|
2018-11-24 15:57:52 +09:00
|
|
|
// nick := ctx.Get("nick")
|
|
|
|
// viewUser, err := arn.GetUserByNick(nick)
|
2017-06-22 12:03:43 -03:00
|
|
|
|
2018-11-24 15:57:52 +09:00
|
|
|
// if err != nil {
|
|
|
|
// return ctx.Error(http.StatusNotFound, "User not found", err)
|
|
|
|
// }
|
2017-06-22 11:21:26 -03:00
|
|
|
|
2018-11-24 15:57:52 +09:00
|
|
|
// posts := viewUser.Posts()
|
|
|
|
// arn.SortPostsLatestFirst(posts)
|
2017-06-22 12:13:55 -03:00
|
|
|
|
2018-11-24 15:57:52 +09:00
|
|
|
// if len(posts) >= postLimit {
|
|
|
|
// posts = posts[:postLimit]
|
|
|
|
// }
|
2017-06-22 11:21:26 -03:00
|
|
|
|
2019-11-17 16:59:34 +09:00
|
|
|
// return ctx.HTML(components.LatestPosts(arn.ToPostables(posts), viewUser, arn.GetUserFromContext(ctx), ctx.Path()))
|
2017-06-22 11:21:26 -03:00
|
|
|
|
2018-11-24 15:57:52 +09:00
|
|
|
// }
|