support hashtags in bios

This commit is contained in:
Ted Unangst 2020-09-25 19:09:01 -04:00
parent f6995ce94e
commit d6ade574f0
3 changed files with 15 additions and 0 deletions

View File

@ -1418,6 +1418,19 @@ func junkuser(user *WhatAbout) junk.Junk {
j["name"] = user.Display j["name"] = user.Display
j["preferredUsername"] = user.Name j["preferredUsername"] = user.Name
j["summary"] = user.HTAbout 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 { if user.ID > 0 {
j["type"] = "Person" j["type"] = "Person"
j["url"] = user.URL j["url"] = user.URL

View File

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

View File

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