27 lines
524 B
Go
Raw Normal View History

2018-04-25 18:59:23 +02:00
package thread
2016-11-19 23:54:31 +09:00
import (
2017-06-26 23:41:16 +02:00
"net/http"
2017-06-26 15:17:53 +02:00
2016-11-19 23:54:31 +09:00
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
2017-06-26 15:17:53 +02:00
"github.com/animenotifier/notify.moe/utils"
2016-11-19 23:54:31 +09:00
)
2017-06-17 01:25:02 +02:00
// Get thread.
2016-11-19 23:54:31 +09:00
func Get(ctx *aero.Context) string {
id := ctx.Get("id")
2017-06-26 15:17:53 +02:00
user := utils.GetUser(ctx)
2016-11-19 23:54:31 +09:00
2017-06-26 23:41:16 +02:00
// Fetch thread
thread, err := arn.GetThread(id)
2016-11-19 23:54:31 +09:00
if err != nil {
2017-06-26 23:41:16 +02:00
return ctx.Error(http.StatusNotFound, "Thread not found", err)
2016-11-19 23:54:31 +09:00
}
ctx.Data = getOpenGraph(ctx, thread)
2018-11-05 19:05:36 +09:00
return ctx.HTML(components.Thread(thread, user))
2016-11-19 23:54:31 +09:00
}