23 lines
417 B
Go
Raw Normal View History

2018-11-22 01:27:53 +00:00
package groups
import (
"sort"
"github.com/aerogo/aero"
)
// Popular shows the most popular groups.
func Popular(ctx *aero.Context) string {
2018-11-22 02:51:44 +00:00
groups := fetchGroups("")
2018-11-22 01:27:53 +00:00
sort.Slice(groups, func(i, j int) bool {
if len(groups[i].Members) == len(groups[j].Members) {
return groups[i].Created > groups[j].Created
}
return len(groups[i].Members) > len(groups[j].Members)
})
return render(ctx, groups)
}