From 953f7c5743be5f4fcf60a6cb7e5514687d621e2b Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Fri, 16 Aug 2019 00:05:22 -0400 Subject: [PATCH] switch to using handles on xzone page --- fun.go | 5 ++++- honk.go | 13 ++++++++----- views/xzone.html | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/fun.go b/fun.go index d15c58f..b16b641 100644 --- a/fun.go +++ b/fun.go @@ -391,7 +391,10 @@ func handles(xid string) (string, string) { } else { handle = p.Handle } - stmtSaveXonker.Exec(xid, handle, "handle") + _, err = stmtSaveXonker.Exec(xid, handle, "handle") + if err != nil { + log.Printf("error saving handle: %s", err) + } } if handle == xid { return xid, xid diff --git a/honk.go b/honk.go index 632c83e..2262942 100644 --- a/honk.go +++ b/honk.go @@ -469,19 +469,22 @@ func ximport(w http.ResponseWriter, r *http.Request) { func xzone(w http.ResponseWriter, r *http.Request) { u := login.GetUserInfo(r) - var honkers []string rows, err := stmtRecentHonkers.Query(u.UserID, u.UserID) if err != nil { log.Printf("query err: %s", err) return } defer rows.Close() + var honkers []Honker for rows.Next() { - var s string - rows.Scan(&s) - honkers = append(honkers, s) + var xid string + rows.Scan(&xid) + honkers = append(honkers, Honker{ XID: xid}) + } + rows.Close() + for i, _ := range honkers { + _, honkers[i].Handle = handles(honkers[i].XID) } - templinfo := getInfo(r) templinfo["XCSRF"] = login.GetCSRF("ximport", r) templinfo["Honkers"] = honkers diff --git a/views/xzone.html b/views/xzone.html index d9ac9bf..55d6176 100644 --- a/views/xzone.html +++ b/views/xzone.html @@ -10,7 +10,7 @@ {{ range .Honkers }}
-

honks by {{ . }} +

honks by {{ .Handle }}

{{ end }}