redo create ingestion to follow normal pipeline (again?)

This commit is contained in:
Ted Unangst 2020-05-13 14:36:16 -04:00
parent ad07e38f95
commit 4721226402
1 changed files with 10 additions and 9 deletions

View File

@ -462,7 +462,7 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
} }
xonkxonkfn = func(item junk.Junk, origin string) *Honk { xonkxonkfn = func(item junk.Junk, origin string) *Honk {
// id, _ := item.GetString( "id") id, _ := item.GetString("id")
what, _ := item.GetString("type") what, _ := item.GetString("type")
dt, ok := item.GetString("published") dt, ok := item.GetString("published")
if !ok { if !ok {
@ -529,19 +529,20 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
if !ok { if !ok {
xid, _ = item.GetString("object") xid, _ = item.GetString("object")
log.Printf("getting created honk: %s", xid) log.Printf("getting created honk: %s", xid)
if originate(xid) != origin {
log.Printf("out of bounds %s not from %s", xid, origin)
return nil
}
obj, err = GetJunkHardMode(xid) obj, err = GetJunkHardMode(xid)
if err != nil { if err != nil {
log.Printf("error getting creation: %s", err) log.Printf("error getting creation: %s", err)
} }
} }
what = "honk" if obj == nil {
if obj != nil { log.Printf("no object for creation %s", id)
t, _ := obj.GetString("type") return nil
switch t {
case "Event":
what = "event"
}
} }
return xonkxonkfn(obj, origin)
case "Read": case "Read":
xid, ok = item.GetString("object") xid, ok = item.GetString("object")
if ok { if ok {
@ -610,7 +611,7 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
return nil return nil
} }
if originate(xid) != origin { if originate(xid) != origin {
log.Printf("original sin: %s <> %s", xid, origin) log.Printf("original sin: %s not from %s", xid, origin)
item.Write(os.Stdout) item.Write(os.Stdout)
return nil return nil
} }