all repos — honk @ 877cba0043b80835ffbc824a86d470101598a1b9

my fork of honk

make redoimages a separate function
Ted Unangst tedu@tedunangst.com
Wed, 04 Dec 2019 02:30:07 -0500
commit

877cba0043b80835ffbc824a86d470101598a1b9

parent

b5482facb8c28fb1fd14fb30ac3f18e734da0fe7

3 files changed, 27 insertions(+), 26 deletions(-)

jump to
M activity.goactivity.go

@@ -1027,7 +1027,8 @@ if !h.Public {

jo["directMessage"] = true } mentions := bunchofgrapes(h.Noise) - translate(h, true) + translate(h) + redoimages(h) jo["summary"] = html.EscapeString(h.Precis) jo["content"] = h.Noise if h.Precis != "" {
M fun.gofun.go

@@ -61,7 +61,7 @@ }

if !h.Public { h.Style += " limited" } - translate(h, false) + translate(h) local := false if (h.Whofore == 2 || h.Whofore == 3) && h.What != "bonked" { local = true

@@ -198,7 +198,7 @@ htf.BaseURL, _ = url.Parse(honk.XID)

htf.String(honk.Noise) } -func translate(honk *Honk, redoimages bool) { +func translate(honk *Honk) { if honk.Format == "html" { return }

@@ -219,31 +219,31 @@ noise = strings.TrimSpace(noise)

noise = markitzero(noise) honk.Noise = noise honk.Onts = oneofakind(ontologies(honk.Noise)) +} - if redoimages { - zap := make(map[string]bool) - { - var htf htfilter.Filter - htf.Imager = replaceimgsand(zap, true) - htf.SpanClasses = allowedclasses - p, _ := htf.String(honk.Precis) - n, _ := htf.String(honk.Noise) - honk.Precis = string(p) - honk.Noise = string(n) - } - j := 0 - for i := 0; i < len(honk.Donks); i++ { - if !zap[honk.Donks[i].XID] { - honk.Donks[j] = honk.Donks[i] - j++ - } +func redoimages(honk *Honk) { + zap := make(map[string]bool) + { + var htf htfilter.Filter + htf.Imager = replaceimgsand(zap, true) + htf.SpanClasses = allowedclasses + p, _ := htf.String(honk.Precis) + n, _ := htf.String(honk.Noise) + honk.Precis = string(p) + honk.Noise = string(n) + } + j := 0 + for i := 0; i < len(honk.Donks); i++ { + if !zap[honk.Donks[i].XID] { + honk.Donks[j] = honk.Donks[i] + j++ } - honk.Donks = honk.Donks[:j] + } + honk.Donks = honk.Donks[:j] - honk.Noise = re_memes.ReplaceAllString(honk.Noise, "") - honk.Noise = ontologize(mentionize(honk.Noise)) - honk.Noise = strings.Replace(honk.Noise, "<a href=", "<a class=\"mention u-url\" href=", -1) - } + honk.Noise = re_memes.ReplaceAllString(honk.Noise, "") + honk.Noise = ontologize(mentionize(honk.Noise)) + honk.Noise = strings.Replace(honk.Noise, "<a href=", "<a class=\"mention u-url\" href=", -1) } func xcelerate(b []byte) string {
M web.goweb.go

@@ -1441,7 +1441,7 @@ noise = quickrename(noise, userinfo.UserID)

noise = hooterize(noise) honk.Mentions = bunchofgrapes(noise) honk.Noise = noise - translate(honk, false) + translate(honk) var convoy string if rid != "" {