don't go down if we're going up
Ted Unangst tedu@tedunangst.com
Tue, 01 Oct 2019 00:01:45 -0400
1 files changed,
16 insertions(+),
5 deletions(-)
jump to
M
activity.go
→
activity.go
@@ -424,6 +424,7 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
depth := 0 maxdepth := 10 currenttid := "" + goingup := 0 var xonkxonkfn func(item junk.Junk, origin string) *Honk saveonemore := func(xid string) {@@ -712,7 +713,13 @@ }
xonk.Onts = oneofakind(xonk.Onts) replyobj, ok := obj.GetMap("replies") if ok { - items, _ := replyobj.GetArray("items") + items, ok := replyobj.GetArray("items") + if !ok { + first, ok := replyobj.GetMap("first") + if ok { + items, _ = first.GetArray("items") + } + } for _, repl := range items { s, ok := repl.(string) if ok {@@ -760,7 +767,9 @@ updatehonk(prev)
} else if needxonk(user, &xonk) { if rid != "" { if needxonkid(user, rid) { + goingup++ saveonemore(rid) + goingup-- } if convoy == "" { xx := getxonk(user.ID, rid)@@ -774,10 +783,12 @@ convoy = currenttid
} savexonk(&xonk) } - for _, replid := range replies { - if needxonkid(user, replid) { - log.Printf("missing a reply: %s", replid) - saveonemore(replid) + if goingup == 0 { + for _, replid := range replies { + if needxonkid(user, replid) { + log.Printf("missing a reply: %s", replid) + saveonemore(replid) + } } } return &xonk