diff --git a/model/status.go b/model/status.go
index a178027..244c9d0 100644
--- a/model/status.go
+++ b/model/status.go
@@ -19,6 +19,7 @@ type Status struct {
}
var urlRegexp = regexp.MustCompile(`https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)`)
+var userRegexp = regexp.MustCompile(`@([a-z0-9-_]+)\b`)
func (s Status) ContentDisplay() string {
content := html.EscapeString(s.Content)
@@ -29,6 +30,12 @@ func (s Status) ContentDisplay() string {
content = strings.Replace(content, url, fmt.Sprintf("%s", url, url), 1)
}
}
+ if userRegexp.MatchString(s.Content) {
+ matches := userRegexp.FindAllStringSubmatch(s.Content, -1)
+ for _, m := range matches {
+ content = strings.Replace(content, m[0], fmt.Sprintf("%s", m[1], m[0]), 1)
+ }
+ }
return content
}