From 50fb0d5e09b881e534d6d63c7fcda0c9062414f3 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Wed, 4 Dec 2019 02:30:07 -0500 Subject: [PATCH] make redoimages a separate function --- activity.go | 3 ++- fun.go | 50 +++++++++++++++++++++++++------------------------- web.go | 2 +- 3 files changed, 28 insertions(+), 27 deletions(-) diff --git a/activity.go b/activity.go index 31315b2..2e61cca 100644 --- a/activity.go +++ b/activity.go @@ -1027,7 +1027,8 @@ func jonkjonk(user *WhatAbout, h *Honk) (junk.Junk, junk.Junk) { 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 != "" { diff --git a/fun.go b/fun.go index 31b6435..a87ec93 100644 --- a/fun.go +++ b/fun.go @@ -61,7 +61,7 @@ func reverbolate(userid int64, honks []*Honk) { 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 @@ func imaginate(honk *Honk) { htf.String(honk.Noise) } -func translate(honk *Honk, redoimages bool) { +func translate(honk *Honk) { if honk.Format == "html" { return } @@ -219,31 +219,31 @@ func translate(honk *Honk, redoimages bool) { 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++ - } - } - honk.Donks = honk.Donks[:j] - - honk.Noise = re_memes.ReplaceAllString(honk.Noise, "") - honk.Noise = ontologize(mentionize(honk.Noise)) - honk.Noise = strings.Replace(honk.Noise, "