all repos — honk @ 3cef9262a56518f7484be1f4553b5233c5926bbe

my fork of honk

switch to using handles on xzone page
Ted Unangst tedu@tedunangst.com
Fri, 16 Aug 2019 00:05:22 -0400
commit

3cef9262a56518f7484be1f4553b5233c5926bbe

parent

94ad2503130114c75b25fce7bb74aa05659898d1

3 files changed, 13 insertions(+), 7 deletions(-)

jump to
M fun.gofun.go

@@ -391,7 +391,10 @@ }

} 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
M honk.gohonk.go

@@ -469,19 +469,22 @@ }

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
M views/xzone.htmlviews/xzone.html

@@ -10,7 +10,7 @@ </form>

</div> {{ range .Honkers }} <section class="honk"> -<p><a href="/h?xid={{ . }}">honks</a> by {{ . }} +<p><a href="/h?xid={{ .XID }}">honks</a> by {{ .Handle }} </section> {{ end }} </main>