all repos — honk @ 0f689ddb639b08a7a104da6d4f1df39d835f873d

my fork of honk

too lazy to change the oonker mistake, add another test in threadsort
Ted Unangst tedu@tedunangst.com
Wed, 21 Jun 2023 19:50:17 -0400
commit

0f689ddb639b08a7a104da6d4f1df39d835f873d

parent

e015662570fbf10b948c8d488acc22543eca4174

1 files changed, 13 insertions(+), 2 deletions(-)

jump to
M web.goweb.go

@@ -1018,6 +1018,17 @@ trackchan <- Track{xid: xid, who: who}

} } +func sameperson(h1, h2 *Honk) bool { + n1, n2 := h1.Honker, h2.Honker + if h1.Oonker != "" { + n1 = h1.Oonker + } + if h2.Oonker != "" { + n2 = h2.Oonker + } + return n1 == n2 +} + func threadsort(honks []*Honk) []*Honk { sort.Slice(honks, func(i, j int) bool { return honks[i].Date.Before(honks[j].Date)

@@ -1035,7 +1046,7 @@ var nextlevel func(p *Honk)

level := 0 nextlevel = func(p *Honk) { levelup := level < 4 - if pp := honkx[p.RID]; p.RID == "" || (pp != nil && p.Honker == pp.Honker) { + if pp := honkx[p.RID]; p.RID == "" || (pp != nil && sameperson(p, pp)) { levelup = false } if level > 0 && len(kids[p.RID]) == 1 {

@@ -1049,7 +1060,7 @@ }

p.Style += fmt.Sprintf(" level%d", level) childs := kids[p.XID] sort.SliceStable(childs, func(i, j int) bool { - return childs[i].Honker == p.Honker && childs[j].Honker != p.Honker + return sameperson(childs[i], p) && !sameperson(childs[j], p) }) for _, h := range childs { if !done[h] {