2017-06-16 23:25:02 +00:00
|
|
|
package profile
|
2017-06-08 12:46:38 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/aerogo/aero"
|
|
|
|
"github.com/animenotifier/arn"
|
|
|
|
"github.com/animenotifier/notify.moe/components"
|
|
|
|
)
|
|
|
|
|
2017-06-16 23:25:02 +00:00
|
|
|
// GetThreadsByUser shows all forum threads of a particular user.
|
|
|
|
func GetThreadsByUser(ctx *aero.Context) string {
|
2017-06-08 12:46:38 +00:00
|
|
|
nick := ctx.Get("nick")
|
|
|
|
user, err := arn.GetUserByNick(nick)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
return ctx.Error(http.StatusNotFound, "User not found", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
threads := user.Threads()
|
|
|
|
arn.SortThreadsByDate(threads)
|
|
|
|
|
|
|
|
return ctx.HTML(components.ThreadList(threads))
|
|
|
|
}
|