31 lines
622 B
Go
Raw Normal View History

2017-10-18 21:17:54 +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-18 21:17:54 +00:00
)
2018-11-21 09:12:29 +00:00
// Feed shows the group front page.
func Feed(ctx *aero.Context) string {
2018-03-06 23:36:04 +00:00
user := utils.GetUser(ctx)
2017-10-18 21:17:54 +00:00
id := ctx.Get("id")
group, err := arn.GetGroup(id)
if err != nil {
return ctx.Error(http.StatusNotFound, "Group not found", err)
}
2018-11-21 09:12:29 +00:00
var member *arn.GroupMember
if user != nil {
member = group.FindMember(user.ID)
}
ctx.Data = getOpenGraph(ctx, group)
return ctx.HTML(components.GroupFeed(group, member, user))
2017-10-18 21:17:54 +00:00
}