2018-11-05 19:05:36 +09:00

26 lines
486 B
Go

package thread
import (
"net/http"
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils"
)
// Get thread.
func Get(ctx *aero.Context) string {
id := ctx.Get("id")
user := utils.GetUser(ctx)
// Fetch thread
thread, err := arn.GetThread(id)
if err != nil {
return ctx.Error(http.StatusNotFound, "Thread not found", err)
}
return ctx.HTML(components.Thread(thread, user))
}