another try at flattening logic

This commit is contained in:
Ted Unangst 2023-06-13 19:26:35 -04:00
parent 6cb5152611
commit 67496c1208
1 changed files with 4 additions and 1 deletions

5
web.go
View File

@ -1023,6 +1023,9 @@ func threadsort(honks []*Honk) []*Honk {
kids := make(map[string][]*Honk) kids := make(map[string][]*Honk)
for _, h := range honks { for _, h := range honks {
honkx[h.XID] = h honkx[h.XID] = h
if h.RID == "" {
honkx[""] = h
}
rid := h.RID rid := h.RID
kids[rid] = append(kids[rid], h) kids[rid] = append(kids[rid], h)
} }
@ -1037,7 +1040,7 @@ func threadsort(honks []*Honk) []*Honk {
p.Style += fmt.Sprintf(" level%d", level) p.Style += fmt.Sprintf(" level%d", level)
} }
levelup := true levelup := true
if pp := honkx[p.RID]; pp == nil || p.Honker == pp.Honker { if pp := honkx[p.RID]; pp != nil && p.Honker == pp.Honker {
levelup = false levelup = false
} }
if levelup { if levelup {