allow renaming shortnames
Ted Unangst tedu@tedunangst.com
Sun, 06 Oct 2019 21:45:58 -0400
3 files changed,
4 insertions(+),
3 deletions(-)
M
database.go
→
database.go
@@ -504,7 +504,7 @@ log.Fatal(err)
} } -var stmtHonkers, stmtDubbers, stmtSaveHonker, stmtUpdateFlavor, stmtUpdateCombos *sql.Stmt +var stmtHonkers, stmtDubbers, stmtSaveHonker, stmtUpdateFlavor, stmtUpdateHonker *sql.Stmt var stmtOneXonk, stmtPublicHonks, stmtUserHonks, stmtHonksByCombo, stmtHonksByConvoy *sql.Stmt var stmtHonksByOntology, stmtHonksForUser, stmtHonksForMe, stmtSaveDub, stmtHonksByXonker *sql.Stmt var stmtHonksBySearch, stmtHonksByHonker, stmtSaveHonk, stmtWhatAbout *sql.Stmt@@ -529,7 +529,7 @@ func prepareStatements(db *sql.DB) {
stmtHonkers = preparetodie(db, "select honkerid, userid, name, xid, flavor, combos from honkers where userid = ? and (flavor = 'sub' or flavor = 'peep' or flavor = 'unsub') order by name") stmtSaveHonker = preparetodie(db, "insert into honkers (userid, name, xid, flavor, combos) values (?, ?, ?, ?, ?)") stmtUpdateFlavor = preparetodie(db, "update honkers set flavor = ? where userid = ? and xid = ? and flavor = ?") - stmtUpdateCombos = preparetodie(db, "update honkers set combos = ? where honkerid = ? and userid = ?") + stmtUpdateHonker = preparetodie(db, "update honkers set name = ?, combos = ? where honkerid = ? and userid = ?") 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'")
M
views/honkers.html
→
views/honkers.html
@@ -38,6 +38,7 @@ <p>flavor: {{ .Flavor }}
<form action="/submithonker" method="POST"> <input type="hidden" name="CSRF" value="{{ $honkercsrf }}"> <input type="hidden" name="honkerid" value="{{ .ID }}"> +<p>name: <input type="text" name="name" value="{{ .Name }}"> <p>combos: <input type="text" name="combos" value="{{ range .Combos }}{{ . }} {{end}}"> {{ if eq .Flavor "sub" }} <p>unsub: <input type="text" name="goodbye" placeholder="press F" value="" autocomplete=off>
M
web.go
→
web.go
@@ -1226,7 +1226,7 @@ http.Redirect(w, r, "/honkers", http.StatusSeeOther)
return } combos = " " + strings.TrimSpace(combos) + " " - _, err := stmtUpdateCombos.Exec(combos, honkerid, u.UserID) + _, err := stmtUpdateHonker.Exec(name, combos, honkerid, u.UserID) if err != nil { log.Printf("update honker err: %s", err) return