From e8c5a307ce47a8723b6e6bf5fdbd285320ee512d Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Fri, 19 Apr 2019 23:23:22 -0400 Subject: [PATCH] sigh. need to defer mentionize to avoid collecting our own html --- activity.go | 2 +- fun.go | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/activity.go b/activity.go index 00dbdd1..c651b1d 100644 --- a/activity.go +++ b/activity.go @@ -584,7 +584,7 @@ func jonkjonk(user *WhatAbout, h *Honk) (map[string]interface{}, map[string]inte if len(h.Audience) > 1 { jo["cc"] = h.Audience[1:] } - jo["content"] = h.Noise + jo["content"] = mentionize(h.Noise) jo["summary"] = nil var tags []interface{} g := bunchofgrapes(h.Noise) diff --git a/fun.go b/fun.go index 51978cf..d930804 100644 --- a/fun.go +++ b/fun.go @@ -40,6 +40,7 @@ func reverbolate(honks []*Honk) { if h.RID != "" && strings.IndexByte(h.RID, '/') == -1 { h.RID = h.Honker + "/h/" + h.RID } + h.Noise = mentionize(h.Noise) } else { idx := strings.LastIndexByte(h.Honker, '/') if idx != -1 { @@ -177,6 +178,10 @@ func obfusbreak(s string) string { s = re_link.ReplaceAllStringFunc(s, linkfn) s = strings.Replace(s, "\n", "
", -1) + return s +} + +func mentionize(s string) string { s = re_mentions.ReplaceAllStringFunc(s, func(m string) string { where := gofish(m) if where == "" {