mirror of
https://github.com/documize/community.git
synced 2025-07-21 06:09:42 +02:00
Add issue creator real names
This commit is contained in:
parent
049ff73825
commit
b419bd2d52
4 changed files with 34 additions and 21 deletions
|
@ -45,6 +45,7 @@ type githubRender struct {
|
|||
ClosedPRs int `json:"closedPRs"`
|
||||
AuthorStats []githubAuthorStats `json:"authorStats"`
|
||||
HasAuthorStats bool `json:"hasAuthorStats"`
|
||||
NumContributors int `json:"numContributors"`
|
||||
}
|
||||
|
||||
type report struct {
|
||||
|
@ -139,6 +140,11 @@ func (c *githubConfig) Clean() {
|
|||
if lastItem < len(c.Lists) {
|
||||
c.Lists[lastItem].Comma = false
|
||||
}
|
||||
|
||||
if c.UserNames == nil {
|
||||
c.UserNames = make(map[string]string)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
type githubCallbackT struct {
|
||||
|
@ -156,3 +162,25 @@ func repoName(branchName string) string {
|
|||
}
|
||||
return pieces[0]
|
||||
}
|
||||
|
||||
func getUserName(client *gogithub.Client, config *githubConfig, login string) (fullName string) {
|
||||
an := login
|
||||
if content, found := config.UserNames[login]; found {
|
||||
if len(content) > 0 {
|
||||
an = content
|
||||
}
|
||||
} else {
|
||||
usr, _, err := client.Users.Get(login)
|
||||
if err == nil {
|
||||
if usr.Name != nil {
|
||||
if len(*usr.Name) > 0 {
|
||||
config.UserNames[login] = *usr.Name
|
||||
an = *usr.Name
|
||||
}
|
||||
}
|
||||
} else {
|
||||
config.UserNames[login] = login // don't look again for a missing name
|
||||
}
|
||||
}
|
||||
return an
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue