support hashtags in bios

Ted Unangst 4 years ago
parent 2cf862e96f
commit 81d69414da

@ -1418,6 +1418,19 @@ func junkuser(user *WhatAbout) junk.Junk {
j["name"] = user.Display
j["preferredUsername"] = user.Name
j["summary"] = user.HTAbout
var tags []junk.Junk
for _, o := range user.Onts {
t := junk.New()
t["type"] = "Hashtag"
o = strings.ToLower(o)
t["href"] = fmt.Sprintf("https://%s/o/%s", serverName, o[1:])
t["name"] = o
tags = append(tags, t)
}
if len(tags) > 0 {
j["tag"] = tags
}
if user.ID > 0 {
j["type"] = "Person"
j["url"] = user.URL

@ -59,6 +59,7 @@ func userfromrow(row *sql.Row) (*WhatAbout, error) {
marker.HashLinker = ontoreplacer
marker.AtLinker = attoreplacer
user.HTAbout = template.HTML(marker.Mark(user.About))
user.Onts = marker.HashTags
return user, nil
}

@ -41,6 +41,7 @@ type WhatAbout struct {
Display string
About string
HTAbout template.HTML
Onts []string
Key string
URL string
Options UserOptions

Loading…
Cancel
Save