Some improvements

This commit is contained in:
2016-12-06 12:36:31 +09:00
parent c2d9817ec5
commit 1268aa8ba6
21 changed files with 72 additions and 273 deletions

View File

@ -1,14 +1,12 @@
package dashboard
import (
"sort"
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
)
const maxPosts = 6
const maxPosts = 5
// Get ...
func Get(ctx *aero.Context) string {
@ -18,7 +16,7 @@ func Get(ctx *aero.Context) string {
return ctx.Error(500, "Error fetching posts", err)
}
sort.Sort(sort.Reverse(posts))
arn.SortPostsLatestFirst(posts)
if len(posts) > maxPosts {
posts = posts[:maxPosts]