all repos — honk @ 45e90d4d2e57c3a4f5101d14a7dc3a44c991302d

my fork of honk

allow renaming shortnames
Ted Unangst tedu@tedunangst.com
Sun, 06 Oct 2019 21:45:58 -0400
commit

45e90d4d2e57c3a4f5101d14a7dc3a44c991302d

parent

56da28ed8e2d4a1847eb873d7e146de806ce1e86

3 files changed, 4 insertions(+), 3 deletions(-)

jump to
M database.godatabase.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.htmlviews/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.goweb.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