2018-11-05 11:57:37 +00:00
|
|
|
package post
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/aerogo/aero"
|
2019-06-03 09:32:43 +00:00
|
|
|
"github.com/animenotifier/notify.moe/arn"
|
2018-11-05 11:57:37 +00:00
|
|
|
"github.com/animenotifier/notify.moe/components"
|
|
|
|
"github.com/animenotifier/notify.moe/utils"
|
|
|
|
)
|
|
|
|
|
|
|
|
// ReplyUI renders a new post area.
|
2019-06-01 04:55:49 +00:00
|
|
|
func ReplyUI(ctx aero.Context) error {
|
2018-11-05 11:57:37 +00:00
|
|
|
id := ctx.Get("id")
|
|
|
|
user := utils.GetUser(ctx)
|
|
|
|
post, err := arn.GetPost(id)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
return ctx.Error(http.StatusNotFound, "Post not found", err)
|
|
|
|
}
|
|
|
|
|
2018-11-15 11:19:40 +00:00
|
|
|
return ctx.HTML(components.NewPostArea(post, user, "Reply") + components.NewPostActions(post, true))
|
2018-11-05 11:57:37 +00:00
|
|
|
}
|