Disabled old profile pages
This commit is contained in:
@ -1,44 +1,44 @@
|
||||
package profilecharacters
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"sort"
|
||||
// import (
|
||||
// "net/http"
|
||||
// "sort"
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
)
|
||||
// "github.com/aerogo/aero"
|
||||
// "github.com/animenotifier/arn"
|
||||
// "github.com/animenotifier/notify.moe/components"
|
||||
// "github.com/animenotifier/notify.moe/utils"
|
||||
// )
|
||||
|
||||
// Liked shows all liked characters of a particular user.
|
||||
func Liked(ctx *aero.Context) string {
|
||||
nick := ctx.Get("nick")
|
||||
viewUser, err := arn.GetUserByNick(nick)
|
||||
// // Liked shows all liked characters of a particular user.
|
||||
// func Liked(ctx *aero.Context) string {
|
||||
// nick := ctx.Get("nick")
|
||||
// viewUser, err := arn.GetUserByNick(nick)
|
||||
|
||||
if err != nil {
|
||||
return ctx.Error(http.StatusNotFound, "User not found", err)
|
||||
}
|
||||
// if err != nil {
|
||||
// return ctx.Error(http.StatusNotFound, "User not found", err)
|
||||
// }
|
||||
|
||||
characters := []*arn.Character{}
|
||||
// characters := []*arn.Character{}
|
||||
|
||||
for character := range arn.StreamCharacters() {
|
||||
if arn.Contains(character.Likes, viewUser.ID) {
|
||||
characters = append(characters, character)
|
||||
}
|
||||
}
|
||||
// for character := range arn.StreamCharacters() {
|
||||
// if arn.Contains(character.Likes, viewUser.ID) {
|
||||
// characters = append(characters, character)
|
||||
// }
|
||||
// }
|
||||
|
||||
sort.Slice(characters, func(i, j int) bool {
|
||||
return characters[i].Name.Canonical < characters[j].Name.Canonical
|
||||
// sort.Slice(characters, func(i, j int) bool {
|
||||
// return characters[i].Name.Canonical < characters[j].Name.Canonical
|
||||
|
||||
// aLikes := len(characters[i].Likes)
|
||||
// bLikes := len(characters[j].Likes)
|
||||
// // aLikes := len(characters[i].Likes)
|
||||
// // bLikes := len(characters[j].Likes)
|
||||
|
||||
// if aLikes == bLikes {
|
||||
// return characters[i].Name.Canonical < characters[j].Name.Canonical
|
||||
// }
|
||||
// // if aLikes == bLikes {
|
||||
// // return characters[i].Name.Canonical < characters[j].Name.Canonical
|
||||
// // }
|
||||
|
||||
// return aLikes > bLikes
|
||||
})
|
||||
// // return aLikes > bLikes
|
||||
// })
|
||||
|
||||
return ctx.HTML(components.ProfileCharacters(characters, viewUser, utils.GetUser(ctx), ctx.URI()))
|
||||
}
|
||||
// return ctx.HTML(components.ProfileCharacters(characters, viewUser, utils.GetUser(ctx), ctx.URI()))
|
||||
// }
|
||||
|
Reference in New Issue
Block a user