2017-10-17 21:17:04 +00:00
|
|
|
package group
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/aerogo/aero"
|
|
|
|
"github.com/animenotifier/arn"
|
|
|
|
"github.com/animenotifier/notify.moe/components"
|
2018-03-06 23:36:04 +00:00
|
|
|
"github.com/animenotifier/notify.moe/utils"
|
2017-10-17 21:17:04 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// Get ...
|
|
|
|
func Get(ctx *aero.Context) string {
|
2018-03-06 23:36:04 +00:00
|
|
|
user := utils.GetUser(ctx)
|
2017-10-17 21:17:04 +00:00
|
|
|
id := ctx.Get("id")
|
|
|
|
group, err := arn.GetGroup(id)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
return ctx.Error(http.StatusNotFound, "Group not found", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx.Data = &arn.OpenGraph{
|
|
|
|
Tags: map[string]string{
|
|
|
|
"og:title": group.Name,
|
|
|
|
"og:url": "https://" + ctx.App.Config.Domain + group.Link(),
|
|
|
|
"og:site_name": "notify.moe",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2018-03-06 23:36:04 +00:00
|
|
|
return ctx.HTML(components.Group(group, user))
|
2017-10-17 21:17:04 +00:00
|
|
|
}
|