sometimes we need to go deeper to find the honk in the bonk

This commit is contained in:
Ted Unangst 2023-06-11 01:40:34 -04:00
parent 7a332ead41
commit 3ff98a261e
1 changed files with 17 additions and 5 deletions

View File

@ -613,6 +613,14 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
case "Announce": case "Announce":
obj, ok = item.GetMap("object") obj, ok = item.GetMap("object")
if ok { if ok {
what, ok := obj.GetString("type")
if ok && what == "Create" {
obj, ok = obj.GetMap("object")
if !ok {
ilog.Printf("lost object inside create %s", id)
return nil
}
}
xid, _ = obj.GetString("id") xid, _ = obj.GetString("id")
} else { } else {
xid, _ = item.GetString("object") xid, _ = item.GetString("object")
@ -620,12 +628,16 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
if !needbonkid(user, xid) { if !needbonkid(user, xid) {
return nil return nil
} }
origin = originate(xid)
if ok && originate(id) == origin {
dlog.Printf("using object in announce for %s", xid)
} else {
dlog.Printf("getting bonk: %s", xid) dlog.Printf("getting bonk: %s", xid)
obj, err = GetJunkHardMode(user.ID, xid) obj, err = GetJunkHardMode(user.ID, xid)
if err != nil { if err != nil {
ilog.Printf("error getting bonk: %s: %s", xid, err) ilog.Printf("error getting bonk: %s: %s", xid, err)
} }
origin = originate(xid) }
what = "bonk" what = "bonk"
case "Update": case "Update":
isUpdate = true isUpdate = true