all repos — honk @ a1f5e5b57cae0f06fad03d6a18ebf94a24912897

my fork of honk

if we kill a word, we should probably kill the whole thread too
Ted Unangst tedu@tedunangst.com
Wed, 10 Jul 2019 17:49:05 -0400
commit

a1f5e5b57cae0f06fad03d6a18ebf94a24912897

parent

909871a7834f224e37d9a26546e2a2e04671a524

1 files changed, 16 insertions(+), 1 deletions(-)

jump to
M fun.gofun.go

@@ -108,18 +108,33 @@ }

func osmosis(honks []*Honk, userid int64) []*Honk { zords := getzords(userid) + for i, j := 0, len(honks)-1; i < j; i, j = i+1, j-1 { + honks[i], honks[j] = honks[j], honks[i] + } + j := 0 + filtered := make(map[string]bool) outer: for _, h := range honks { + if h.RID != "" && filtered[h.RID] { + filtered[h.XID] = true + continue outer + } + for _, z := range zords { if z.MatchString(h.Precis) || z.MatchString(h.Noise) { + filtered[h.XID] = true continue outer } } honks[j] = h j++ } - return honks[0:j] + honks = honks[0:j] + for i, j := 0, len(honks)-1; i < j; i, j = i+1, j-1 { + honks[i], honks[j] = honks[j], honks[i] + } + return honks } func shortxid(xid string) string {