27 lines
622 B
Go
Raw Normal View History

2017-07-21 09:01:34 +00:00
package profile
import (
"net/http"
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils"
)
// GetFollowers shows the followers of a particular user.
func GetFollowers(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)
}
followers := viewUser.Followers()
2017-07-21 09:25:53 +00:00
arn.SortUsersLastSeen(followers)
2017-07-21 09:01:34 +00:00
return ctx.HTML(components.ProfileFollowers(followers, viewUser, utils.GetUser(ctx), ctx.URI()))
}