all repos — honk @ 3bb430b8462c66d2114929ff529d88d98a401d2c

my fork of honk

reduce number of honks on some pages
Ted Unangst tedu@tedunangst.com
Tue, 12 Nov 2019 01:43:16 -0500
commit

3bb430b8462c66d2114929ff529d88d98a401d2c

parent

65617bf87caad4e41d86a52e4f25a5a7150f9f78

2 files changed, 9 insertions(+), 9 deletions(-)

jump to
M database.godatabase.go

@@ -166,11 +166,11 @@ }

func getpublichonks() []*Honk { dt := time.Now().UTC().Add(-7 * 24 * time.Hour).Format(dbtimeformat) - rows, err := stmtPublicHonks.Query(dt) + rows, err := stmtPublicHonks.Query(dt, 25) return getsomehonks(rows, err) } func geteventhonks(userid int64) []*Honk { - rows, err := stmtEventHonks.Query(userid) + rows, err := stmtEventHonks.Query(userid, 25) honks := getsomehonks(rows, err) sort.Slice(honks, func(i, j int) bool { var t1, t2 time.Time

@@ -199,10 +199,12 @@ }

func gethonksbyuser(name string, includeprivate bool, wanted int64) []*Honk { dt := time.Now().UTC().Add(-7 * 24 * time.Hour).Format(dbtimeformat) whofore := 2 + limit := 25 if includeprivate { whofore = 3 + limit = 50 } - rows, err := stmtUserHonks.Query(wanted, whofore, name, dt) + rows, err := stmtUserHonks.Query(wanted, whofore, name, dt, limit) return getsomehonks(rows, err) } func gethonksforuser(userid int64, wanted int64) []*Honk {

@@ -712,13 +714,14 @@ stmtNamedDubbers = preparetodie(db, "select honkerid, userid, name, xid, flavor from honkers where userid = ? and name = ? and flavor = 'dub'")

selecthonks := "select honks.honkid, honks.userid, username, what, honker, oonker, honks.xid, rid, dt, url, audience, noise, precis, format, convoy, whofore, flags from honks join users on honks.userid = users.userid " limit := " order by honks.honkid desc limit 250" + smalllimit := " order by honks.honkid desc limit ?" butnotthose := " and convoy not in (select name from zonkers where userid = ? and wherefore = 'zonvoy' order by zonkerid desc limit 100)" stmtOneXonk = preparetodie(db, selecthonks+"where honks.userid = ? and xid = ?") stmtAnyXonk = preparetodie(db, selecthonks+"where xid = ? order by honks.honkid asc") stmtOneBonk = preparetodie(db, selecthonks+"where honks.userid = ? and xid = ? and what = 'bonk' and whofore = 2") - stmtPublicHonks = preparetodie(db, selecthonks+"where whofore = 2 and dt > ?"+limit) - stmtEventHonks = preparetodie(db, selecthonks+"where (whofore = 2 or honks.userid = ?) and what = 'event'"+limit) - stmtUserHonks = preparetodie(db, selecthonks+"where honks.honkid > ? and (whofore = 2 or whofore = ?) and username = ? and dt > ?"+limit) + stmtPublicHonks = preparetodie(db, selecthonks+"where whofore = 2 and dt > ?"+smalllimit) + stmtEventHonks = preparetodie(db, selecthonks+"where (whofore = 2 or honks.userid = ?) and what = 'event'"+smalllimit) + stmtUserHonks = preparetodie(db, selecthonks+"where honks.honkid > ? and (whofore = 2 or whofore = ?) and username = ? and dt > ?"+smalllimit) myhonkers := " and honker in (select xid from honkers where userid = ? and (flavor = 'sub' or flavor = 'peep' or flavor = 'presub') and combos not like '% - %')" stmtHonksForUser = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and dt > ?"+myhonkers+butnotthose+limit) stmtHonksForUserFirstClass = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and dt > ? and (what <> 'tonk')"+myhonkers+butnotthose+limit)
M web.goweb.go

@@ -161,9 +161,6 @@ honks = gethonksbyuser(name, false, 0)

} else { honks = getpublichonks() } - if len(honks) > 20 { - honks = honks[0:20] - } reverbolate(-1, honks) home := fmt.Sprintf("https://%s/", serverName)