when logged in, show everything for tag

This commit is contained in:
Ted Unangst 2019-08-25 22:53:56 -04:00
parent be64eff398
commit c8953f2f21
1 changed files with 8 additions and 4 deletions

12
honk.go
View File

@ -633,7 +633,11 @@ func showconvoy(w http.ResponseWriter, r *http.Request) {
func showontology(w http.ResponseWriter, r *http.Request) { func showontology(w http.ResponseWriter, r *http.Request) {
name := mux.Vars(r)["name"] name := mux.Vars(r)["name"]
u := login.GetUserInfo(r) u := login.GetUserInfo(r)
honks := gethonksbyontology("#" + name) var userid int64 = -1
if u != nil {
userid = u.UserID
}
honks := gethonksbyontology(userid, "#"+name)
honkpage(w, r, u, nil, honks, template.HTML(html.EscapeString("honks by ontology: "+name))) honkpage(w, r, u, nil, honks, template.HTML(html.EscapeString("honks by ontology: "+name)))
} }
@ -852,8 +856,8 @@ func gethonksbyconvoy(userid int64, convoy string) []*Honk {
} }
return honks return honks
} }
func gethonksbyontology(name string) []*Honk { func gethonksbyontology(userid int64, name string) []*Honk {
rows, err := stmtHonksByOntology.Query(name) rows, err := stmtHonksByOntology.Query(name, userid, userid)
honks := getsomehonks(rows, err) honks := getsomehonks(rows, err)
return honks return honks
} }
@ -1724,7 +1728,7 @@ func prepareStatements(db *sql.DB) {
stmtHonksByXonker = preparetodie(db, selecthonks+" where honks.userid = ? and (honker = ? or oonker = ?)"+butnotthose+limit) stmtHonksByXonker = preparetodie(db, selecthonks+" where honks.userid = ? and (honker = ? or oonker = ?)"+butnotthose+limit)
stmtHonksByCombo = preparetodie(db, selecthonks+"join honkers on honkers.xid = honks.honker where honks.userid = ? and honkers.combos like ?"+butnotthose+limit) stmtHonksByCombo = preparetodie(db, selecthonks+"join honkers on honkers.xid = honks.honker where honks.userid = ? and honkers.combos like ?"+butnotthose+limit)
stmtHonksByConvoy = preparetodie(db, selecthonks+"where (honks.userid = ? or (? = -1 and whofore = 2)) and convoy = ?"+limit) stmtHonksByConvoy = preparetodie(db, selecthonks+"where (honks.userid = ? or (? = -1 and whofore = 2)) and convoy = ?"+limit)
stmtHonksByOntology = preparetodie(db, selecthonks+"join onts on honks.honkid = onts.honkid where onts.ontology = ? and honks.whofore = 2"+limit) stmtHonksByOntology = preparetodie(db, selecthonks+"join onts on honks.honkid = onts.honkid where onts.ontology = ? and (honks.userid = ? or (? = -1 and honks.whofore = 2))"+limit)
stmtSaveHonk = preparetodie(db, "insert into honks (userid, what, honker, xid, rid, dt, url, audience, noise, convoy, whofore, format, precis, oonker, flags, onts) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)") stmtSaveHonk = preparetodie(db, "insert into honks (userid, what, honker, xid, rid, dt, url, audience, noise, convoy, whofore, format, precis, oonker, flags, onts) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
stmtSaveOnts = preparetodie(db, "insert into onts (ontology, honkid) values (?, ?)") stmtSaveOnts = preparetodie(db, "insert into onts (ontology, honkid) values (?, ?)")