all repos — honk @ 595a894f90cc59a027e119c0dd057ab8b61e007d

my fork of honk

simplify the async zonking
Ted Unangst tedu@tedunangst.com
Mon, 17 Jun 2019 12:10:36 -0400
commit

595a894f90cc59a027e119c0dd057ab8b61e007d

parent

625f4286a19223550b5cae699872f872c4519b27

2 files changed, 10 insertions(+), 21 deletions(-)

jump to
M honk.gohonk.go

@@ -807,20 +807,10 @@ }

func zonkit(w http.ResponseWriter, r *http.Request) { wherefore := r.FormValue("wherefore") - var what string + what := r.FormValue("what") switch wherefore { - case "this honk": - what = r.FormValue("honk") - wherefore = "zonk" - case "this honker": - what = r.FormValue("honker") - wherefore = "zonker" - case "this convoy": - what = r.FormValue("convoy") - wherefore = "zonvoy" - } - if what == "" { - return + case "zonk": + case "zonvoy": } log.Printf("zonking %s %s", wherefore, what)

@@ -843,12 +833,11 @@ log.Printf("announcing deleted honk: %s", what)

go honkworldwide(user, &zonk) } } - } else { - _, err := stmtSaveZonker.Exec(userinfo.UserID, what, wherefore) - if err != nil { - log.Printf("error saving zonker: %s", err) - return - } + } + _, err := stmtSaveZonker.Exec(userinfo.UserID, what, wherefore) + if err != nil { + log.Printf("error saving zonker: %s", err) + return } }
M views/honkpage.htmlviews/honkpage.html

@@ -39,7 +39,7 @@ }

function muteit(el, convoy) { el.innerHTML = "muted" el.disabled = true - post("/zonkit", "CSRF={{ $BonkCSRF }}&wherefore=this+convoy&convoy=" + escape(convoy)) + post("/zonkit", "CSRF={{ $BonkCSRF }}&wherefore=zonvoy&what=" + escape(convoy)) var els = document.querySelectorAll('article.honk') for (var i = 0; i < els.length; i++) { var e = els[i]

@@ -51,7 +51,7 @@ }

function zonkit(el, xid) { el.innerHTML = "zonked" el.disabled = true - post("/zonkit", "CSRF={{ $BonkCSRF }}&wherefore=this+honk&honk=" + escape(xid)) + post("/zonkit", "CSRF={{ $BonkCSRF }}&wherefore=zonk&what=" + escape(xid)) var p = el while (p && p.tagName != "ARTICLE") { p = p.parentElement