45 lines
1.2 KiB
Go
Raw Normal View History

2018-04-19 14:23:14 +00:00
package profilecharacters
2018-12-04 23:49:21 +00:00
// import (
// "net/http"
// "sort"
2018-04-19 14:23:14 +00:00
2018-12-04 23:49:21 +00:00
// "github.com/aerogo/aero"
// "github.com/animenotifier/arn"
// "github.com/animenotifier/notify.moe/components"
// "github.com/animenotifier/notify.moe/utils"
// )
2018-04-19 14:23:14 +00:00
2018-12-04 23:49:21 +00:00
// // Liked shows all liked characters of a particular user.
// func Liked(ctx *aero.Context) string {
// nick := ctx.Get("nick")
// viewUser, err := arn.GetUserByNick(nick)
2018-04-19 14:23:14 +00:00
2018-12-04 23:49:21 +00:00
// if err != nil {
// return ctx.Error(http.StatusNotFound, "User not found", err)
// }
2018-04-19 14:23:14 +00:00
2018-12-04 23:49:21 +00:00
// characters := []*arn.Character{}
2018-04-19 14:23:14 +00:00
2018-12-04 23:49:21 +00:00
// for character := range arn.StreamCharacters() {
// if arn.Contains(character.Likes, viewUser.ID) {
// characters = append(characters, character)
// }
// }
2018-04-19 14:23:14 +00:00
2018-12-04 23:49:21 +00:00
// sort.Slice(characters, func(i, j int) bool {
// return characters[i].Name.Canonical < characters[j].Name.Canonical
2018-04-19 14:23:14 +00:00
2018-12-04 23:49:21 +00:00
// // aLikes := len(characters[i].Likes)
// // bLikes := len(characters[j].Likes)
2018-04-19 14:23:14 +00:00
2018-12-04 23:49:21 +00:00
// // if aLikes == bLikes {
// // return characters[i].Name.Canonical < characters[j].Name.Canonical
// // }
2018-04-19 14:23:14 +00:00
2018-12-04 23:49:21 +00:00
// // return aLikes > bLikes
// })
2018-04-19 14:23:14 +00:00
2018-12-04 23:49:21 +00:00
// return ctx.HTML(components.ProfileCharacters(characters, viewUser, utils.GetUser(ctx), ctx.URI()))
// }