From cd7537c11061a50f624ce233f5cc7f0f0e451810 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Tue, 25 Feb 2020 13:37:44 -0500 Subject: [PATCH] better handling of address input --- fun.go | 11 ++++++++--- web.go | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/fun.go b/fun.go index bba2c6e..29c3cc1 100644 --- a/fun.go +++ b/fun.go @@ -295,13 +295,18 @@ func grapevine(mentions []Mention) []string { return s } -func grapeape(s string) []Mention { +func grapeape(userid int64, s string) []Mention { var mentions []Mention for _, m := range strings.Split(s, " ") { - if m == "" { + if m == "" { continue } - where := gofish(m) + var where string + if name := fullname(m, userid); name != "" { + where = name + } else { + where = gofish(m) + } if where != "" { mentions = append(mentions, Mention{Who: m, Where: where}) } diff --git a/web.go b/web.go index 51c2ede..029a86e 100644 --- a/web.go +++ b/web.go @@ -1481,7 +1481,7 @@ func submithonk(w http.ResponseWriter, r *http.Request, isAPI bool) { noise = strings.Replace(noise, "\r", "", -1) noise = quickrename(noise, userinfo.UserID) noise = hooterize(noise) - honk.Mentions = append(grapeape(mentions), bunchofgrapes(noise)...) + honk.Mentions = append(grapeape(userinfo.UserID, mentions), bunchofgrapes(noise)...) honk.Noise = noise translate(honk)