diff --git a/activity.go b/activity.go index 9a8daa4..951cbd4 100644 --- a/activity.go +++ b/activity.go @@ -1099,12 +1099,6 @@ func jonkjonk(user *WhatAbout, h *Honk) (junk.Junk, junk.Junk) { if !h.Public { jo["directMessage"] = true } - var mentions []Mention - if len(h.Mentions) > 0 { - mentions = h.Mentions - } else { - mentions = bunchofgrapes(h.Noise) - } translate(h) redoimages(h) if h.Precis != "" { @@ -1124,7 +1118,7 @@ func jonkjonk(user *WhatAbout, h *Honk) (junk.Junk, junk.Junk) { } var tags []junk.Junk - for _, m := range mentions { + for _, m := range h.Mentions { t := junk.New() t["type"] = "Mention" t["name"] = m.Who diff --git a/fun.go b/fun.go index 8988c8c..ae92f1a 100644 --- a/fun.go +++ b/fun.go @@ -33,8 +33,8 @@ import ( "humungus.tedunangst.com/r/webs/cache" "humungus.tedunangst.com/r/webs/htfilter" "humungus.tedunangst.com/r/webs/httpsig" - "humungus.tedunangst.com/r/webs/templates" "humungus.tedunangst.com/r/webs/mz" + "humungus.tedunangst.com/r/webs/templates" ) var allowedclasses = make(map[string]bool) @@ -68,7 +68,6 @@ func reverbolate(userid int64, honks []*Honk) { } if local && h.What != "bonked" { h.Noise = re_memes.ReplaceAllString(h.Noise, "") - h.Noise = mentionize(h.Noise) } h.Username, h.Handle = handles(h.Honker) if !local { @@ -238,10 +237,12 @@ func translate(honk *Honk) { var marker mz.Marker marker.HashLinker = ontoreplacer + marker.AtLinker = attoreplacer noise = strings.TrimSpace(noise) noise = marker.Mark(noise) honk.Noise = noise honk.Onts = oneofakind(marker.HashTags) + honk.Mentions = bunchofgrapes(marker.Mentions) } func redoimages(honk *Honk) { @@ -265,7 +266,6 @@ func redoimages(honk *Honk) { honk.Donks = honk.Donks[:j] honk.Noise = re_memes.ReplaceAllString(honk.Noise, "") - honk.Noise = mentionize(honk.Noise) honk.Noise = strings.Replace(honk.Noise, "%s` - s = re_mentions.ReplaceAllStringFunc(s, func(m string) string { - where := gofish(m) - if where == "" { - return m - } - who := m[0 : 1+strings.IndexByte(m[1:], '@')] - return fmt.Sprintf(fill, html.EscapeString(where), html.EscapeString(who)) - }) - s = re_urltions.ReplaceAllStringFunc(s, func(m string) string { - return fmt.Sprintf(fill, html.EscapeString(m[1:]), html.EscapeString(m)) - }) - return s + where := gofish(m) + if where == "" { + return m + } + who := m[0 : 1+strings.IndexByte(m[1:], '@')] + return fmt.Sprintf(fill, html.EscapeString(where), html.EscapeString(who)) } func ontoreplacer(h string) string { return fmt.Sprintf(`%s`, serverName, - strings.ToLower(h[1:]), h) + strings.ToLower(h[1:]), h) } var re_unurl = regexp.MustCompile("https://([^/]+).*/([^/]+)") diff --git a/web.go b/web.go index cda4073..212b114 100644 --- a/web.go +++ b/web.go @@ -1600,7 +1600,6 @@ func submithonk(w http.ResponseWriter, r *http.Request) *Honk { noise = strings.Replace(noise, "\r", "", -1) noise = quickrename(noise, userinfo.UserID) noise = hooterize(noise) - honk.Mentions = bunchofgrapes(noise) honk.Noise = noise translate(honk) @@ -1632,9 +1631,9 @@ func submithonk(w http.ResponseWriter, r *http.Request) *Honk { honk.Audience = []string{thewholeworld} } if honk.Noise != "" && honk.Noise[0] == '@' { - honk.Audience = append(grapevine(bunchofgrapes(honk.Noise)), honk.Audience...) + honk.Audience = append(grapevine(honk.Mentions), honk.Audience...) } else { - honk.Audience = append(honk.Audience, grapevine(bunchofgrapes(honk.Noise))...) + honk.Audience = append(honk.Audience, grapevine(honk.Mentions)...) } if convoy == "" {