2016-12-06 03:36:31 +00:00
|
|
|
package users
|
|
|
|
|
|
|
|
import (
|
2017-06-10 00:19:31 +00:00
|
|
|
"net/http"
|
2017-06-10 00:51:11 +00:00
|
|
|
"sort"
|
2017-06-10 00:19:31 +00:00
|
|
|
|
2016-12-06 03:36:31 +00:00
|
|
|
"github.com/aerogo/aero"
|
2017-06-10 00:19:31 +00:00
|
|
|
"github.com/animenotifier/arn"
|
2016-12-06 03:36:31 +00:00
|
|
|
"github.com/animenotifier/notify.moe/components"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Get ...
|
|
|
|
func Get(ctx *aero.Context) string {
|
2017-06-10 00:19:31 +00:00
|
|
|
users, err := arn.FilterUsers(func(user *arn.User) bool {
|
2017-06-10 00:51:11 +00:00
|
|
|
return user.IsActive() && user.Avatar != ""
|
|
|
|
})
|
|
|
|
|
|
|
|
sort.Slice(users, func(i, j int) bool {
|
|
|
|
return users[i].Registered < users[j].Registered
|
2017-06-10 00:19:31 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
return ctx.Error(http.StatusInternalServerError, "Could not fetch user data", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return ctx.HTML(components.Users(users))
|
2016-12-06 03:36:31 +00:00
|
|
|
}
|