if we already have it, don't get it
Ted Unangst tedu@tedunangst.com
Tue, 01 Oct 2019 23:30:10 -0400
1 files changed,
23 insertions(+),
20 deletions(-)
jump to
M
web.go
→
web.go
@@ -374,29 +374,32 @@ }
} func ximport(w http.ResponseWriter, r *http.Request) { + u := login.GetUserInfo(r) xid := r.FormValue("xid") - p, _ := investigate(xid) - if p != nil { - xid = p.XID - } - j, err := GetJunk(xid) - if err != nil { - http.Error(w, "error getting external object", http.StatusInternalServerError) - log.Printf("error getting external object: %s", err) - return - } - log.Printf("importing %s", xid) - u := login.GetUserInfo(r) - user, _ := butwhatabout(u.Username) + xonk := getxonk(u.UserID, xid) + if xonk == nil { + p, _ := investigate(xid) + if p != nil { + xid = p.XID + } + j, err := GetJunk(xid) + if err != nil { + http.Error(w, "error getting external object", http.StatusInternalServerError) + log.Printf("error getting external object: %s", err) + return + } + log.Printf("importing %s", xid) + user, _ := butwhatabout(u.Username) - what, _ := j.GetString("type") - if isactor(what) { - outbox, _ := j.GetString("outbox") - gimmexonks(user, outbox) - http.Redirect(w, r, "/h?xid="+url.QueryEscape(xid), http.StatusSeeOther) - return + what, _ := j.GetString("type") + if isactor(what) { + outbox, _ := j.GetString("outbox") + gimmexonks(user, outbox) + http.Redirect(w, r, "/h?xid="+url.QueryEscape(xid), http.StatusSeeOther) + return + } + xonk = xonksaver(user, j, originate(xid)) } - xonk := xonksaver(user, j, originate(xid)) convoy := "" if xonk != nil { convoy = xonk.Convoy