fndf
This commit is contained in:
parent
ebc23d652f
commit
3a91ee6264
1 changed files with 4 additions and 4 deletions
|
|
@ -16,7 +16,7 @@ type Status struct {
|
|||
Content string
|
||||
Face string
|
||||
CreatedAt time.Time
|
||||
Number int `json:"number"`
|
||||
Number int `db:"number" json:"number"`
|
||||
}
|
||||
|
||||
var urlRegexp = regexp.MustCompile(`https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)`)
|
||||
|
|
@ -34,7 +34,7 @@ func (s Status) ContentDisplay() string {
|
|||
if userRegexp.MatchString(s.Content) {
|
||||
matches := userRegexp.FindAllStringSubmatch(s.Content, -1)
|
||||
for _, m := range matches {
|
||||
content = strings.Replace(content, m[0], fmt.Sprintf("<a href=\"https://status.cafe/users/%s\" target=\"_blank\">%s</a>", m[1], m[0]), 1)
|
||||
content = strings.Replace(content, m[0], fmt.Sprintf("<a href=\"https://sillywordz.kissing.computer/users/%s\" target=\"_blank\">%s</a>", m[1], m[0]), 1)
|
||||
}
|
||||
}
|
||||
return content
|
||||
|
|
@ -45,8 +45,8 @@ func (s Status) ContentHtml() template.HTML {
|
|||
}
|
||||
|
||||
func (s Status) Validate() error {
|
||||
if len(s.Content) == 0 {
|
||||
return errors.New("content is empty")
|
||||
if s.Number == 0 {
|
||||
return errors.New("u gotta add a count man")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue