Upgraded to latest aero version
This commit is contained in:
@ -11,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
// Edit ...
|
||||
func Edit(ctx *aero.Context) string {
|
||||
func Edit(ctx aero.Context) error {
|
||||
id := ctx.Get("id")
|
||||
group, err := arn.GetGroup(id)
|
||||
user := utils.GetUser(ctx)
|
||||
@ -30,7 +30,7 @@ func Edit(ctx *aero.Context) string {
|
||||
}
|
||||
|
||||
// EditImage renders the form to edit the group images.
|
||||
func EditImage(ctx *aero.Context) string {
|
||||
func EditImage(ctx aero.Context) error {
|
||||
id := ctx.Get("id")
|
||||
group, err := arn.GetGroup(id)
|
||||
user := utils.GetUser(ctx)
|
||||
|
@ -6,11 +6,12 @@ import (
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
"github.com/animenotifier/notify.moe/middleware"
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
)
|
||||
|
||||
// Feed shows the group front page.
|
||||
func Feed(ctx *aero.Context) string {
|
||||
func Feed(ctx aero.Context) error {
|
||||
user := utils.GetUser(ctx)
|
||||
id := ctx.Get("id")
|
||||
group, err := arn.GetGroup(id)
|
||||
@ -25,6 +26,7 @@ func Feed(ctx *aero.Context) string {
|
||||
member = group.FindMember(user.ID)
|
||||
}
|
||||
|
||||
ctx.Data = getOpenGraph(ctx, group)
|
||||
customCtx := ctx.(*middleware.OpenGraphContext)
|
||||
customCtx.OpenGraph = getOpenGraph(ctx, group)
|
||||
return ctx.HTML(components.GroupFeed(group, member, user))
|
||||
}
|
||||
|
@ -6,11 +6,12 @@ import (
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
"github.com/animenotifier/notify.moe/middleware"
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
)
|
||||
|
||||
// Info shows the group information page.
|
||||
func Info(ctx *aero.Context) string {
|
||||
func Info(ctx aero.Context) error {
|
||||
user := utils.GetUser(ctx)
|
||||
id := ctx.Get("id")
|
||||
group, err := arn.GetGroup(id)
|
||||
@ -25,6 +26,7 @@ func Info(ctx *aero.Context) string {
|
||||
member = group.FindMember(user.ID)
|
||||
}
|
||||
|
||||
ctx.Data = getOpenGraph(ctx, group)
|
||||
customCtx := ctx.(*middleware.OpenGraphContext)
|
||||
customCtx.OpenGraph = getOpenGraph(ctx, group)
|
||||
return ctx.HTML(components.GroupInfo(group, member, user))
|
||||
}
|
||||
|
@ -6,11 +6,12 @@ import (
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
"github.com/animenotifier/notify.moe/middleware"
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
)
|
||||
|
||||
// Members shows the group members.
|
||||
func Members(ctx *aero.Context) string {
|
||||
func Members(ctx aero.Context) error {
|
||||
user := utils.GetUser(ctx)
|
||||
id := ctx.Get("id")
|
||||
group, err := arn.GetGroup(id)
|
||||
@ -25,6 +26,7 @@ func Members(ctx *aero.Context) string {
|
||||
member = group.FindMember(user.ID)
|
||||
}
|
||||
|
||||
ctx.Data = getOpenGraph(ctx, group)
|
||||
customCtx := ctx.(*middleware.OpenGraphContext)
|
||||
customCtx.OpenGraph = getOpenGraph(ctx, group)
|
||||
return ctx.HTML(components.GroupMembers(group, member, user))
|
||||
}
|
||||
|
@ -3,15 +3,16 @@ package group
|
||||
import (
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/notify.moe/assets"
|
||||
)
|
||||
|
||||
func getOpenGraph(ctx *aero.Context, group *arn.Group) *arn.OpenGraph {
|
||||
func getOpenGraph(ctx aero.Context, group *arn.Group) *arn.OpenGraph {
|
||||
return &arn.OpenGraph{
|
||||
Tags: map[string]string{
|
||||
"og:title": group.Name,
|
||||
"og:description": group.Tagline,
|
||||
"og:image": "https:" + group.ImageLink("large"),
|
||||
"og:url": "https://" + ctx.App.Config.Domain + group.Link(),
|
||||
"og:url": "https://" + assets.Domain + group.Link(),
|
||||
"og:site_name": "notify.moe",
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user