all repos — honk @ 20834a96c8603c9bbd40b8d11550856ffe19ea28

my fork of honk

don't grab honks from other users when constructing convoys
Ted Unangst tedu@tedunangst.com
Tue, 09 Jul 2019 23:37:30 -0400
commit

20834a96c8603c9bbd40b8d11550856ffe19ea28

parent

58bf6f26077efe66d531e99222cbc5a26b775832

1 files changed, 3 insertions(+), 7 deletions(-)

jump to
M honk.gohonk.go

@@ -570,12 +570,8 @@ honkpage(w, r, u, nil, honks, "honks by combo: "+name)

} func showconvoy(w http.ResponseWriter, r *http.Request) { c := r.FormValue("c") - var userid int64 = -1 u := login.GetUserInfo(r) - if u != nil { - userid = u.UserID - } - honks := gethonksbyconvoy(userid, c) + honks := gethonksbyconvoy(u.UserID, c) honkpage(w, r, u, nil, honks, "honks in convoy: "+c) }

@@ -773,7 +769,7 @@ rows, err := stmtHonksByCombo.Query(userid, combo, userid)

return getsomehonks(rows, err) } func gethonksbyconvoy(userid int64, convoy string) []*Honk { - rows, err := stmtHonksByConvoy.Query(userid, convoy) + rows, err := stmtHonksByConvoy.Query(userid, userid, convoy) honks := getsomehonks(rows, err) for i, j := 0, len(honks)-1; i < j; i, j = i+1, j-1 { honks[i], honks[j] = honks[j], honks[i]

@@ -1556,7 +1552,7 @@ 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) stmtHonksByXonker = preparetodie(db, selecthonks+" where honks.userid = ? and honker = ?"+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 whofore = 2) and convoy = ?"+limit) + stmtHonksByConvoy = preparetodie(db, selecthonks+"where (honks.userid = ? or (? = -1 and whofore = 2)) and convoy = ?"+limit) stmtSaveHonk = preparetodie(db, "insert into honks (userid, what, honker, xid, rid, dt, url, audience, noise, convoy, whofore, format, precis, oonker) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)") stmtFileData = preparetodie(db, "select media, content from files where xid = ?")