sigh. need to defer mentionize to avoid collecting our own html

This commit is contained in:
Ted Unangst 2019-04-19 23:23:22 -04:00
parent 58c0db0296
commit e8c5a307ce
2 changed files with 6 additions and 1 deletions

View File

@ -584,7 +584,7 @@ func jonkjonk(user *WhatAbout, h *Honk) (map[string]interface{}, map[string]inte
if len(h.Audience) > 1 { if len(h.Audience) > 1 {
jo["cc"] = h.Audience[1:] jo["cc"] = h.Audience[1:]
} }
jo["content"] = h.Noise jo["content"] = mentionize(h.Noise)
jo["summary"] = nil jo["summary"] = nil
var tags []interface{} var tags []interface{}
g := bunchofgrapes(h.Noise) g := bunchofgrapes(h.Noise)

5
fun.go
View File

@ -40,6 +40,7 @@ func reverbolate(honks []*Honk) {
if h.RID != "" && strings.IndexByte(h.RID, '/') == -1 { if h.RID != "" && strings.IndexByte(h.RID, '/') == -1 {
h.RID = h.Honker + "/h/" + h.RID h.RID = h.Honker + "/h/" + h.RID
} }
h.Noise = mentionize(h.Noise)
} else { } else {
idx := strings.LastIndexByte(h.Honker, '/') idx := strings.LastIndexByte(h.Honker, '/')
if idx != -1 { if idx != -1 {
@ -177,6 +178,10 @@ func obfusbreak(s string) string {
s = re_link.ReplaceAllStringFunc(s, linkfn) s = re_link.ReplaceAllStringFunc(s, linkfn)
s = strings.Replace(s, "\n", "<br>", -1) s = strings.Replace(s, "\n", "<br>", -1)
return s
}
func mentionize(s string) string {
s = re_mentions.ReplaceAllStringFunc(s, func(m string) string { s = re_mentions.ReplaceAllStringFunc(s, func(m string) string {
where := gofish(m) where := gofish(m)
if where == "" { if where == "" {