Removed unnecessary parameters
This commit is contained in:
parent
dbf5175990
commit
af8929a1ba
@ -1,10 +1,7 @@
|
|||||||
package profile
|
package profile
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"sort"
|
|
||||||
|
|
||||||
"github.com/aerogo/aero"
|
"github.com/aerogo/aero"
|
||||||
"github.com/aerogo/flow"
|
|
||||||
"github.com/animenotifier/arn"
|
"github.com/animenotifier/arn"
|
||||||
"github.com/animenotifier/notify.moe/components"
|
"github.com/animenotifier/notify.moe/components"
|
||||||
"github.com/animenotifier/notify.moe/utils"
|
"github.com/animenotifier/notify.moe/utils"
|
||||||
@ -27,25 +24,9 @@ func Get(ctx *aero.Context) string {
|
|||||||
|
|
||||||
// Profile renders the user profile page of the given viewUser.
|
// Profile renders the user profile page of the given viewUser.
|
||||||
func Profile(ctx *aero.Context, viewUser *arn.User) string {
|
func Profile(ctx *aero.Context, viewUser *arn.User) string {
|
||||||
var user *arn.User
|
user := utils.GetUser(ctx)
|
||||||
var threads []*arn.Thread
|
animeList := viewUser.AnimeList()
|
||||||
var animeList *arn.AnimeList
|
animeList.SortByRating()
|
||||||
var tracks []*arn.SoundTrack
|
|
||||||
var posts []*arn.Post
|
|
||||||
|
|
||||||
flow.Parallel(func() {
|
|
||||||
user = utils.GetUser(ctx)
|
|
||||||
}, func() {
|
|
||||||
animeList = viewUser.AnimeList()
|
|
||||||
|
|
||||||
// Sort by rating
|
|
||||||
animeList.Lock()
|
|
||||||
defer animeList.Unlock()
|
|
||||||
|
|
||||||
sort.Slice(animeList.Items, func(i, j int) bool {
|
|
||||||
return animeList.Items[i].Rating.Overall > animeList.Items[j].Rating.Overall
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
openGraph := &arn.OpenGraph{
|
openGraph := &arn.OpenGraph{
|
||||||
Tags: map[string]string{
|
Tags: map[string]string{
|
||||||
@ -65,5 +46,5 @@ func Profile(ctx *aero.Context, viewUser *arn.User) string {
|
|||||||
|
|
||||||
ctx.Data = openGraph
|
ctx.Data = openGraph
|
||||||
|
|
||||||
return ctx.HTML(components.Profile(viewUser, user, animeList, threads, posts, tracks, ctx.URI()))
|
return ctx.HTML(components.Profile(viewUser, user, animeList, ctx.URI()))
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
component Profile(viewUser *arn.User, user *arn.User, animeList *arn.AnimeList, threads []*arn.Thread, posts []*arn.Post, tracks []*arn.SoundTrack, uri string)
|
component Profile(viewUser *arn.User, user *arn.User, animeList *arn.AnimeList, uri string)
|
||||||
ProfileHeader(viewUser, user, uri)
|
ProfileHeader(viewUser, user, uri)
|
||||||
|
|
||||||
if len(animeList.Items) == 0
|
if len(animeList.Items) == 0
|
||||||
|
Loading…
Reference in New Issue
Block a user