diff --git a/database.go b/database.go index dd1176e..3696c35 100644 --- a/database.go +++ b/database.go @@ -901,6 +901,7 @@ func cleanupdb(arg string) { } var stmtHonkers, stmtDubbers, stmtNamedDubbers, stmtSaveHonker, stmtUpdateFlavor, stmtUpdateHonker *sql.Stmt +var stmtDeleteHonker *sql.Stmt var stmtAnyXonk, stmtOneXonk, stmtPublicHonks, stmtUserHonks, stmtHonksByCombo, stmtHonksByConvoy *sql.Stmt var stmtHonksByOntology, stmtHonksForUser, stmtHonksForMe, stmtSaveDub, stmtHonksByXonker *sql.Stmt var stmtHonksFromLongAgo *sql.Stmt @@ -931,6 +932,7 @@ func prepareStatements(db *sql.DB) { stmtSaveHonker = preparetodie(db, "insert into honkers (userid, name, xid, flavor, combos, owner, meta, folxid) values (?, ?, ?, ?, ?, ?, ?, '')") stmtUpdateFlavor = preparetodie(db, "update honkers set flavor = ?, folxid = ? where userid = ? and name = ? and xid = ? and flavor = ?") stmtUpdateHonker = preparetodie(db, "update honkers set name = ?, combos = ?, meta = ? where honkerid = ? and userid = ?") + stmtDeleteHonker = preparetodie(db, "delete from honkers where honkerid = ?") stmtOneHonker = preparetodie(db, "select xid from honkers where name = ? and userid = ?") stmtDubbers = preparetodie(db, "select honkerid, userid, name, xid, flavor from honkers where userid = ? and flavor = 'dub'") stmtNamedDubbers = preparetodie(db, "select honkerid, userid, name, xid, flavor from honkers where userid = ? and name = ? and flavor = 'dub'") diff --git a/views/honkers.html b/views/honkers.html index 295e406..54fcca2 100644 --- a/views/honkers.html +++ b/views/honkers.html @@ -48,12 +48,11 @@ function expandstuff() {


combos: -{{ if eq .Flavor "sub" }} -

unsub: -{{ else }} -

(re)sub: -{{ end }} -

+

+ + + +

diff --git a/web.go b/web.go index d819daa..11adf5b 100644 --- a/web.go +++ b/web.go @@ -1852,16 +1852,17 @@ func submithonker(w http.ResponseWriter, r *http.Request) { defer honkerinvalidator.Clear(u.UserID) if honkerid > 0 { - goodbye := r.FormValue("goodbye") - if goodbye == "F" { + if r.FormValue("delete") == "delete" { unfollowyou(user, honkerid) + stmtDeleteHonker.Exec(honkerid) http.Redirect(w, r, "/honkers", http.StatusSeeOther) return } - if goodbye == "X" { + if r.FormValue("unsub") == "unsub" { + unfollowyou(user, honkerid) + } + if r.FormValue("sub") == "sub" { followyou(user, honkerid) - http.Redirect(w, r, "/honkers", http.StatusSeeOther) - return } _, err := stmtUpdateHonker.Exec(name, combos, mj, honkerid, u.UserID) if err != nil {