diff --git a/pages/dashboard/dashboard.go b/pages/dashboard/dashboard.go index 54498f71..f71591c4 100644 --- a/pages/dashboard/dashboard.go +++ b/pages/dashboard/dashboard.go @@ -29,7 +29,8 @@ func Get(ctx *aero.Context) string { // Render the dashboard. func dashboard(ctx *aero.Context) string { - var posts []*arn.Post + var forumPosts []arn.Postable + var forumThreads []arn.Postable var userList interface{} var followingList []*arn.User var soundTracks []*arn.SoundTrack @@ -38,15 +39,21 @@ func dashboard(ctx *aero.Context) string { user := utils.GetUser(ctx) flow.Parallel(func() { - var err error - posts, err = arn.AllPosts() + posts, err := arn.AllPosts() if err != nil { return } - arn.SortPostsLatestFirst(posts) - posts = arn.FilterPostsWithUniqueThreads(posts, maxPosts) + forumPosts = arn.ToPostables(posts) + }, func() { + threads, err := arn.AllThreads() + + if err != nil { + return + } + + forumThreads = arn.ToPostables(threads) }, func() { animeList, err := arn.GetAnimeList(user) @@ -114,5 +121,13 @@ func dashboard(ctx *aero.Context) string { } }) - return ctx.HTML(components.Dashboard(upcomingEpisodes, posts, soundTracks, followingList)) + forumActivity := append(forumPosts, forumThreads...) + + sort.Slice(forumActivity, func(i, j int) bool { + return forumActivity[i].Created() > forumActivity[j].Created() + }) + + forumActivity = arn.FilterPostablesWithUniqueThreads(forumActivity, maxPosts) + + return ctx.HTML(components.Dashboard(upcomingEpisodes, forumActivity, soundTracks, followingList)) } diff --git a/pages/dashboard/dashboard.pixy b/pages/dashboard/dashboard.pixy index 4189ff1d..767c74cf 100644 --- a/pages/dashboard/dashboard.pixy +++ b/pages/dashboard/dashboard.pixy @@ -1,4 +1,4 @@ -component Dashboard(schedule []*arn.UpcomingEpisode, posts []*arn.Post, soundTracks []*arn.SoundTrack, following []*arn.User) +component Dashboard(schedule []*arn.UpcomingEpisode, posts []arn.Postable, soundTracks []*arn.SoundTrack, following []*arn.User) h2.page-title Dash .widgets