aboutsummaryrefslogtreecommitdiffstats
path: root/bug/person.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-09-25 17:55:20 +0200
committerMichael Muré <batolettre@gmail.com>2018-09-25 17:55:20 +0200
commit5d7c3a76af85a857a6bb0bff5bac5282c0a9908f (patch)
treedc0d051f09128a96eefba7a6d8cac458bb4e5379 /bug/person.go
parenta72ea453a919b8f456cc46fbb7a1156d9f649442 (diff)
downloadgit-bug-5d7c3a76af85a857a6bb0bff5bac5282c0a9908f.tar.gz
bug: add the optional field AvatarUrl to Person
Diffstat (limited to 'bug/person.go')
-rw-r--r--bug/person.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/bug/person.go b/bug/person.go
index ff4d4a70..c79e9935 100644
--- a/bug/person.go
+++ b/bug/person.go
@@ -10,8 +10,9 @@ import (
)
type Person struct {
- Name string `json:"name"`
- Email string `json:"email"`
+ Name string `json:"name"`
+ Email string `json:"email"`
+ AvatarUrl string `json:"avatar_url"`
}
// GetUser will query the repository for user detail and build the corresponding Person
@@ -61,6 +62,10 @@ func (p Person) Validate() error {
return fmt.Errorf("email is not fully printable")
}
+ if p.AvatarUrl != "" && !text.ValidUrl(p.AvatarUrl) {
+ return fmt.Errorf("avatarUrl is not a valid URL")
+ }
+
return nil
}