also save handle when ingesting
This commit is contained in:
parent
528e768278
commit
5032f180d1
27
activity.go
27
activity.go
|
@ -1389,6 +1389,7 @@ func allinjest(origin string, obj junk.Junk) {
|
||||||
ingestpubkey(origin, keyobj)
|
ingestpubkey(origin, keyobj)
|
||||||
}
|
}
|
||||||
ingestboxes(origin, obj)
|
ingestboxes(origin, obj)
|
||||||
|
ingesthandle(origin, obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ingestpubkey(origin string, obj junk.Junk) {
|
func ingestpubkey(origin string, obj junk.Junk) {
|
||||||
|
@ -1439,6 +1440,9 @@ func ingestboxes(origin string, obj junk.Junk) {
|
||||||
if ident == "" {
|
if ident == "" {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if originate(ident) != origin {
|
||||||
|
return
|
||||||
|
}
|
||||||
var info string
|
var info string
|
||||||
row := stmtGetXonker.QueryRow(ident, "boxes")
|
row := stmtGetXonker.QueryRow(ident, "boxes")
|
||||||
err := row.Scan(&info)
|
err := row.Scan(&info)
|
||||||
|
@ -1457,3 +1461,26 @@ func ingestboxes(origin string, obj junk.Junk) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ingesthandle(origin string, obj junk.Junk) {
|
||||||
|
xid, _ := obj.GetString("id")
|
||||||
|
if xid == "" {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if originate(xid) != origin {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var handle string
|
||||||
|
row := stmtGetXonker.QueryRow(xid, "handle")
|
||||||
|
err := row.Scan(&handle)
|
||||||
|
if err == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
handle, _ = obj.GetString("preferredUsername")
|
||||||
|
if handle != "" {
|
||||||
|
_, err = stmtSaveXonker.Exec(xid, handle, "handle")
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("error saving handle: %s", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
4
fun.go
4
fun.go
|
@ -508,10 +508,6 @@ var allhandles = cache.New(cache.Options{Filler: func(xid string) (string, bool)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
handle = info.Name
|
handle = info.Name
|
||||||
_, err = stmtSaveXonker.Exec(xid, handle, "handle")
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("error saving handle: %s", err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return handle, true
|
return handle, true
|
||||||
|
|
Loading…
Reference in New Issue