better handling of address input

This commit is contained in:
Ted Unangst 2020-02-25 13:37:44 -05:00
parent 0b38c46d37
commit cd7537c110
2 changed files with 9 additions and 4 deletions

9
fun.go
View File

@ -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 == "" {
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})
}

2
web.go
View File

@ -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)