31 lines
646 B
Go
Raw Normal View History

2018-03-17 03:19:23 +00:00
package editor
import (
"sort"
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/kitsu"
"github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils"
)
// NewKitsuAnime ...
func NewKitsuAnime(ctx *aero.Context) string {
user := utils.GetUser(ctx)
2018-04-04 12:51:55 +00:00
allAnime := arn.AllAnime()
2018-03-17 03:19:23 +00:00
animes := arn.FilterKitsuAnime(func(anime *kitsu.Anime) bool {
2018-04-04 12:51:55 +00:00
return arn.FindKitsuAnime(anime.ID, allAnime) != nil
2018-03-17 03:19:23 +00:00
})
sort.Slice(animes, func(i, j int) bool {
a := animes[i]
b := animes[j]
return a.ID > b.ID
})
return ctx.HTML(components.NewKitsuAnime(animes, ctx.URI(), user))
}