repair loss of bonker information in last refactor

This commit is contained in:
Ted Unangst 2023-08-06 03:04:37 -04:00
parent 2514129b3a
commit d2f812058b
1 changed files with 15 additions and 12 deletions

View File

@ -493,7 +493,7 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
maxdepth := 10 maxdepth := 10
currenttid := "" currenttid := ""
goingup := 0 goingup := 0
var xonkxonkfn func(junk.Junk, string, bool, bool) *Honk var xonkxonkfn func(junk.Junk, string, bool, string) *Honk
qutify := func(user *WhatAbout, content string) string { qutify := func(user *WhatAbout, content string) string {
if depth >= maxdepth { if depth >= maxdepth {
@ -525,7 +525,7 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
} }
prevdepth := depth prevdepth := depth
depth = maxdepth depth = maxdepth
xonkxonkfn(j, originate(m), false, false) xonkxonkfn(j, originate(m), false, "")
depth = prevdepth depth = prevdepth
} }
} }
@ -544,10 +544,10 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
ilog.Printf("error getting onemore: %s: %s", xid, err) ilog.Printf("error getting onemore: %s: %s", xid, err)
return return
} }
xonkxonkfn(obj, originate(xid), false, false) xonkxonkfn(obj, originate(xid), false, "")
} }
xonkxonkfn = func(item junk.Junk, origin string, isUpdate bool, isAnnounce bool) *Honk { xonkxonkfn = func(item junk.Junk, origin string, isUpdate bool, bonker string) *Honk {
id, _ := item.GetString("id") id, _ := item.GetString("id")
what := firstofmany(item, "type") what := firstofmany(item, "type")
dt, ok := item.GetString("published") dt, ok := item.GetString("published")
@ -627,6 +627,7 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
if !isUpdate && !needbonkid(user, xid) { if !isUpdate && !needbonkid(user, xid) {
return nil return nil
} }
bonker, _ = item.GetString("actor")
origin = originate(xid) origin = originate(xid)
if ok && originate(id) == origin { if ok && originate(id) == origin {
dlog.Printf("using object in announce for %s", xid) dlog.Printf("using object in announce for %s", xid)
@ -638,7 +639,7 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
return nil return nil
} }
} }
return xonkxonkfn(obj, origin, isUpdate, true) return xonkxonkfn(obj, origin, isUpdate, bonker)
case "Update": case "Update":
isUpdate = true isUpdate = true
fallthrough fallthrough
@ -660,7 +661,7 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
ilog.Printf("no object for creation %s", id) ilog.Printf("no object for creation %s", id)
return nil return nil
} }
return xonkxonkfn(obj, origin, isUpdate, isAnnounce) return xonkxonkfn(obj, origin, isUpdate, bonker)
case "Read": case "Read":
xid, ok = item.GetString("object") xid, ok = item.GetString("object")
if ok { if ok {
@ -673,7 +674,7 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
ilog.Printf("error getting read: %s", err) ilog.Printf("error getting read: %s", err)
return nil return nil
} }
return xonkxonkfn(obj, originate(xid), false, false) return xonkxonkfn(obj, originate(xid), false, "")
} }
return nil return nil
case "Add": case "Add":
@ -689,7 +690,7 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
ilog.Printf("error getting add: %s", err) ilog.Printf("error getting add: %s", err)
return nil return nil
} }
return xonkxonkfn(obj, originate(xid), false, false) return xonkxonkfn(obj, originate(xid), false, "")
} }
return nil return nil
case "Move": case "Move":
@ -718,7 +719,7 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
obj = item obj = item
what = "event" what = "event"
case "ChatMessage": case "ChatMessage":
isAnnounce = false bonker = ""
obj = item obj = item
what = "chonk" what = "chonk"
default: default:
@ -726,7 +727,7 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
dumpactivity(item) dumpactivity(item)
return nil return nil
} }
if isAnnounce { if bonker != "" {
what = "bonk" what = "bonk"
} }
@ -759,7 +760,9 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
if xonk.Honker == "" { if xonk.Honker == "" {
xonk.Honker = extractattrto(obj) xonk.Honker = extractattrto(obj)
} }
xonk.Oonker = extractattrto(obj) if bonker != "" {
xonk.Honker, xonk.Oonker = bonker, xonk.Honker
}
if xonk.Oonker == xonk.Honker { if xonk.Oonker == xonk.Honker {
xonk.Oonker = "" xonk.Oonker = ""
} }
@ -1129,7 +1132,7 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
return &xonk return &xonk
} }
return xonkxonkfn(item, origin, false, false) return xonkxonkfn(item, origin, false, "")
} }
func dumpactivity(item junk.Junk) { func dumpactivity(item junk.Junk) {