sort chatter

This commit is contained in:
Ted Unangst 2020-05-23 19:32:32 -04:00
parent 68752c28e5
commit f6a3e6934e
1 changed files with 11 additions and 0 deletions

View File

@ -586,6 +586,17 @@ func loadchatter(userid int64) []*Chatter {
Chonks: chonks,
})
}
sort.Slice(chatter, func(i, j int) bool {
a, b := chatter[i], chatter[j]
if len(a.Chonks) == 0 || len(b.Chonks) == 0 {
if len(a.Chonks) == len(b.Chonks) {
return a.Target < b.Target
}
return len(a.Chonks) > len(b.Chonks)
}
return a.Chonks[len(a.Chonks)-1].Date.After(b.Chonks[len(b.Chonks)-1].Date)
})
return chatter
}