Upgraded to latest aero version
This commit is contained in:
@ -3,15 +3,18 @@ package quote
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/animenotifier/notify.moe/middleware"
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/notify.moe/assets"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
"github.com/animenotifier/notify.moe/utils/editform"
|
||||
)
|
||||
|
||||
// Edit quote.
|
||||
func Edit(ctx *aero.Context) string {
|
||||
func Edit(ctx aero.Context) error {
|
||||
user := utils.GetUser(ctx)
|
||||
id := ctx.Get("id")
|
||||
quote, err := arn.GetQuote(id)
|
||||
@ -20,16 +23,17 @@ func Edit(ctx *aero.Context) string {
|
||||
return ctx.Error(http.StatusNotFound, "Quote not found", err)
|
||||
}
|
||||
|
||||
ctx.Data = &arn.OpenGraph{
|
||||
customCtx := ctx.(*middleware.OpenGraphContext)
|
||||
customCtx.OpenGraph = &arn.OpenGraph{
|
||||
Tags: map[string]string{
|
||||
"og:title": quote.Text.English,
|
||||
"og:url": "https://" + ctx.App.Config.Domain + quote.Link(),
|
||||
"og:url": "https://" + assets.Domain + quote.Link(),
|
||||
"og:site_name": "notify.moe",
|
||||
},
|
||||
}
|
||||
|
||||
if quote.Character() != nil {
|
||||
ctx.Data.(*arn.OpenGraph).Tags["og:image"] = quote.Character().ImageLink("large")
|
||||
customCtx.OpenGraph.Tags["og:image"] = quote.Character().ImageLink("large")
|
||||
}
|
||||
|
||||
return ctx.HTML(components.QuoteTabs(quote, user) + editform.Render(quote, "Edit quote", user))
|
||||
|
Reference in New Issue
Block a user