diff --git a/pages/dashboard/dashboard.go b/pages/dashboard/dashboard.go index f37bbf1c..67c49eb3 100644 --- a/pages/dashboard/dashboard.go +++ b/pages/dashboard/dashboard.go @@ -32,18 +32,21 @@ func Get(ctx *aero.Context) string { } followIDList := user.Following + var followingList []*arn.User - if len(followIDList) > maxFollowing { - followIDList = followIDList[:maxFollowing] + if len(followIDList) > 0 { + if len(followIDList) > maxFollowing { + followIDList = followIDList[:maxFollowing] + } + + userList, err := arn.DB.GetMany("User", followIDList) + + if err != nil { + return ctx.Error(500, "Error fetching followed users", err) + } + + followingList = userList.([]*arn.User) } - userList, err := arn.DB.GetMany("User", followIDList) - - if err != nil { - return ctx.Error(500, "Error fetching followed users", err) - } - - followingList := userList.([]*arn.User) - return ctx.HTML(components.Dashboard(posts, followingList)) }