From af8929a1ba45696f1ce8e788bd714ffba2445888 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Wed, 29 Nov 2017 00:15:43 +0100 Subject: [PATCH] Removed unnecessary parameters --- pages/profile/profile.go | 27 ++++----------------------- pages/profile/profile.pixy | 2 +- 2 files changed, 5 insertions(+), 24 deletions(-) diff --git a/pages/profile/profile.go b/pages/profile/profile.go index e8dfc1a7..534176a0 100644 --- a/pages/profile/profile.go +++ b/pages/profile/profile.go @@ -1,10 +1,7 @@ package profile import ( - "sort" - "github.com/aerogo/aero" - "github.com/aerogo/flow" "github.com/animenotifier/arn" "github.com/animenotifier/notify.moe/components" "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. func Profile(ctx *aero.Context, viewUser *arn.User) string { - var user *arn.User - var threads []*arn.Thread - var animeList *arn.AnimeList - 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 - }) - }) + user := utils.GetUser(ctx) + animeList := viewUser.AnimeList() + animeList.SortByRating() openGraph := &arn.OpenGraph{ Tags: map[string]string{ @@ -65,5 +46,5 @@ func Profile(ctx *aero.Context, viewUser *arn.User) string { 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())) } diff --git a/pages/profile/profile.pixy b/pages/profile/profile.pixy index b9caf91a..400d8c03 100644 --- a/pages/profile/profile.pixy +++ b/pages/profile/profile.pixy @@ -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) if len(animeList.Items) == 0