diff --git a/pages/dashboard/dashboard.go b/pages/dashboard/dashboard.go index 4552a98c..48a36c05 100644 --- a/pages/dashboard/dashboard.go +++ b/pages/dashboard/dashboard.go @@ -31,10 +31,16 @@ func Get(ctx *aero.Context) string { posts = posts[:maxPosts] } - userList, err := arn.DB.GetMany("User", user.Following[:maxFollowing]) + followIDList := user.Following + + if len(followIDList) > maxFollowing { + followIDList = followIDList[:maxFollowing] + } + + userList, err := arn.DB.GetMany("User", followIDList) if err != nil { - return ctx.Error(500, "Error fetching following", err) + return ctx.Error(500, "Error fetching followers", err) } followingList := userList.([]*arn.User) diff --git a/pages/dashboard/dashboard.pixy b/pages/dashboard/dashboard.pixy index 7f2aa69f..2fb996bb 100644 --- a/pages/dashboard/dashboard.pixy +++ b/pages/dashboard/dashboard.pixy @@ -38,14 +38,15 @@ component Dashboard(posts []*arn.Post, followers []*arn.User) Icon("comment") span ... - .widget.mountable - h3.widget-title Contacts + if len(followers) > 0 + .widget.mountable + h3.widget-title Contacts - each follower in followers - a.widget-element.ajax(href="/+" + follower.Nick) - .widget-element-text - Icon("address-card") - span!= follower.Nick + each follower in followers + a.widget-element.ajax(href="/+" + follower.Nick) + .widget-element-text + Icon("address-card") + span= follower.Nick .widget.mountable h3.widget-title Follow