Improved group page design
This commit is contained in:
30
pages/group/info.go
Normal file
30
pages/group/info.go
Normal file
@ -0,0 +1,30 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
)
|
||||
|
||||
// Info shows the group information page.
|
||||
func Info(ctx *aero.Context) string {
|
||||
user := utils.GetUser(ctx)
|
||||
id := ctx.Get("id")
|
||||
group, err := arn.GetGroup(id)
|
||||
|
||||
if err != nil {
|
||||
return ctx.Error(http.StatusNotFound, "Group not found", err)
|
||||
}
|
||||
|
||||
var member *arn.GroupMember
|
||||
|
||||
if user != nil {
|
||||
member = group.FindMember(user.ID)
|
||||
}
|
||||
|
||||
ctx.Data = getOpenGraph(ctx, group)
|
||||
return ctx.HTML(components.GroupInfo(group, member, user))
|
||||
}
|
Reference in New Issue
Block a user