allow renaming shortnames
This commit is contained in:
parent
9ad6418c16
commit
df94bdb4ed
|
@ -504,7 +504,7 @@ func cleanupdb(arg string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 stmtOneXonk, stmtPublicHonks, stmtUserHonks, stmtHonksByCombo, stmtHonksByConvoy *sql.Stmt
|
||||||
var stmtHonksByOntology, stmtHonksForUser, stmtHonksForMe, stmtSaveDub, stmtHonksByXonker *sql.Stmt
|
var stmtHonksByOntology, stmtHonksForUser, stmtHonksForMe, stmtSaveDub, stmtHonksByXonker *sql.Stmt
|
||||||
var stmtHonksBySearch, stmtHonksByHonker, stmtSaveHonk, stmtWhatAbout *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")
|
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 (?, ?, ?, ?, ?)")
|
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 = ?")
|
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 = ?")
|
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'")
|
stmtDubbers = preparetodie(db, "select honkerid, userid, name, xid, flavor from honkers where userid = ? and flavor = 'dub'")
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ function expandstuff() {
|
||||||
<form action="/submithonker" method="POST">
|
<form action="/submithonker" method="POST">
|
||||||
<input type="hidden" name="CSRF" value="{{ $honkercsrf }}">
|
<input type="hidden" name="CSRF" value="{{ $honkercsrf }}">
|
||||||
<input type="hidden" name="honkerid" value="{{ .ID }}">
|
<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}}">
|
<p>combos: <input type="text" name="combos" value="{{ range .Combos }}{{ . }} {{end}}">
|
||||||
{{ if eq .Flavor "sub" }}
|
{{ if eq .Flavor "sub" }}
|
||||||
<p>unsub: <input type="text" name="goodbye" placeholder="press F" value="" autocomplete=off>
|
<p>unsub: <input type="text" name="goodbye" placeholder="press F" value="" autocomplete=off>
|
||||||
|
|
2
web.go
2
web.go
|
@ -1226,7 +1226,7 @@ func submithonker(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
combos = " " + strings.TrimSpace(combos) + " "
|
combos = " " + strings.TrimSpace(combos) + " "
|
||||||
_, err := stmtUpdateCombos.Exec(combos, honkerid, u.UserID)
|
_, err := stmtUpdateHonker.Exec(name, combos, honkerid, u.UserID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("update honker err: %s", err)
|
log.Printf("update honker err: %s", err)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue