From cead81bccb89ce1a68c04298a41b3d710c6b3c6f Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Fri, 17 May 2019 17:53:06 -0400 Subject: [PATCH] homepage change: only followed honkers shown, allow silence with -. --- honk.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/honk.go b/honk.go index 253a745..850161c 100644 --- a/honk.go +++ b/honk.go @@ -594,7 +594,7 @@ func gethonksbyuser(name string) []*Honk { } func gethonksforuser(userid int64) []*Honk { dt := time.Now().UTC().Add(-7 * 24 * time.Hour).Format(dbtimeformat) - rows, err := stmtHonksForUser.Query(userid, dt, userid) + rows, err := stmtHonksForUser.Query(userid, dt, userid, userid) return getsomehonks(rows, err) } func gethonksforme(userid int64) []*Honk { @@ -949,6 +949,11 @@ func showcombos(w http.ResponseWriter, r *http.Request) { for _, h := range honkers { combos = append(combos, h.Combos...) } + for i, c := range combos { + if c == "-" { + combos[i] = "" + } + } combos = oneofakind(combos) sort.Strings(combos) templinfo["Combos"] = combos @@ -1320,7 +1325,7 @@ func prepareStatements(db *sql.DB) { stmtOneXonk = preparetodie(db, selecthonks+"where honks.userid = ? and xid = ?") stmtPublicHonks = preparetodie(db, selecthonks+"where honker = '' and dt > ?"+limit) stmtUserHonks = preparetodie(db, selecthonks+"where honker = '' and username = ? and dt > ?"+limit) - stmtHonksForUser = preparetodie(db, selecthonks+"where honks.userid = ? and dt > ?"+butnotthose+limit) + stmtHonksForUser = preparetodie(db, selecthonks+"where honks.userid = ? and dt > ? and honker in (select xid from honkers where userid = ? and flavor = 'sub' and combos not like '% - %')"+butnotthose+limit) stmtHonksForMe = preparetodie(db, selecthonks+"where honks.userid = ? and dt > ? and whofore = 1"+butnotthose+limit) stmtHonksByHonker = preparetodie(db, selecthonks+"join honkers on honkers.xid = honks.honker where honks.userid = ? and honkers.name = ?"+butnotthose+limit) stmtHonksByCombo = preparetodie(db, selecthonks+"join honkers on honkers.xid = honks.honker where honks.userid = ? and honkers.combos like ?"+butnotthose+limit)