diff --git a/database.go b/database.go index e144ffb..c5004f8 100644 --- a/database.go +++ b/database.go @@ -480,6 +480,8 @@ func donksforhonks(honks []*Honk) { } case "wonkles": h.Wonkles = j + case "guesses": + h.Guesses = template.HTML(j) case "oldrev": default: elog.Printf("unknown meta genus: %s", genus) @@ -896,6 +898,13 @@ func saveextras(tx *sql.Tx, h *Honk) error { return err } } + if g := h.Guesses; g != "" { + _, err := tx.Stmt(stmtSaveMeta).Exec(h.ID, "guesses", g) + if err != nil { + elog.Printf("error saving guesses: %s", err) + return err + } + } return nil } diff --git a/honk.go b/honk.go index 80aeb46..749363c 100644 --- a/honk.go +++ b/honk.go @@ -100,6 +100,7 @@ type Honk struct { Mentions []Mention Badonks []Badonk Wonkles string + Guesses template.HTML } type Badonk struct { diff --git a/views/honk.html b/views/honk.html index 7fe5d1c..5866412 100644 --- a/views/honk.html +++ b/views/honk.html @@ -92,7 +92,8 @@ in reply to: {{ .RID }} {{ if eq .Honk.What "wonked" }}

{{ if and $bonkcsrf .Honk.IsWonked }} -{{ .Honk.Noise }} +{{ .Honk.Guesses }} +

{{ .Honk.Noise }} {{ else }} {{ end }} diff --git a/views/wonk.js b/views/wonk.js index 7346e9d..2a242b2 100644 --- a/views/wonk.js +++ b/views/wonk.js @@ -74,7 +74,7 @@ export function makeaguess(btn) { } div.innerHTML = mess if (typeof(csrftoken) != "undefined") - post("/zonkit", encode({"CSRF": csrftoken, "wherefore": "wonk", "what": host.xid})) + post("/zonkit", encode({"CSRF": csrftoken, "wherefore": "wonk", "guesses": host.guesses.join("

"), "what": host.xid})) } else { div.innerHTML = "

" } diff --git a/web.go b/web.go index 5bf0bbb..ce12c60 100644 --- a/web.go +++ b/web.go @@ -1304,6 +1304,10 @@ func zonkit(w http.ResponseWriter, r *http.Request) { xonk := getxonk(userinfo.UserID, what) if xonk != nil { _, err := stmtUpdateFlags.Exec(flagIsWonked, xonk.ID) + if err == nil { + guesses := r.FormValue("guesses") + _, err = stmtSaveMeta.Exec(xonk.ID, "guesses", guesses) + } if err != nil { elog.Printf("error saving: %s", err) }