all repos — honk @ b9c7fb253fe7d89846ba287ec0cafff32139b92a

my fork of honk

return the correct honks for thread update.
not yet ordered correctly client side.
Ted Unangst tedu@tedunangst.com
Sun, 07 Jan 2024 21:12:44 -0500
commit

b9c7fb253fe7d89846ba287ec0cafff32139b92a

parent

ff16378e7e65238d2279ebb00acece7a5a71c309

2 files changed, 21 insertions(+), 4 deletions(-)

jump to
M views/honkpage.jsviews/honkpage.js

@@ -131,7 +131,7 @@ var honksonpage = document.getElementById("honksonpage")

var holder = honksonpage.children[0] var lenhonks = honks.length for (var i = honks.length; i > 0; i--) { - var h = honks[i-1] + var h = honks[frontload ? i-1 : 0] if (glowit) h.classList.add("glow") if (frontload) {
M web.goweb.go

@@ -1105,6 +1105,18 @@ }

return n1 == n2 } +func threadposes(honks []*Honk, wanted int64) ([]*Honk, []int) { + var poses []int + var newhonks []*Honk + for i, honk := range honks { + if honk.ID > wanted { + newhonks = append(newhonks, honk) + poses = append(poses, i) + } + } + return newhonks, poses +} + func threadsort(honks []*Honk) []*Honk { sort.Slice(honks, func(i, j int) bool { return honks[i].Date.Before(honks[j].Date)

@@ -2415,6 +2427,7 @@ Srvmsg template.HTML

Honks string MeCount int64 ChatCount int64 + Poses []int } func webhydra(w http.ResponseWriter, r *http.Request) {

@@ -2458,10 +2471,10 @@ honks = osmosis(honks, userid, false)

hydra.Srvmsg = templates.Sprintf("honks by combo: %s", c) case "convoy": c := r.FormValue("c") - honks = gethonksbyconvoy(userid, c, wanted) + honks = gethonksbyconvoy(userid, c, 0) honks = osmosis(honks, userid, false) honks = threadsort(honks) - reversehonks(honks) + honks, hydra.Poses = threadposes(honks, wanted) hydra.Srvmsg = templates.Sprintf("honks in convoy: %s", c) case "honker": xid := r.FormValue("xid")

@@ -2482,7 +2495,11 @@ http.NotFound(w, r)

} if len(honks) > 0 { - hydra.Tophid = honks[0].ID + if page == "convoy" { + hydra.Tophid = honks[len(honks)-1].ID + } else { + hydra.Tophid = honks[0].ID + } } else { hydra.Tophid = wanted }