|
|
@ -238,6 +238,7 @@ type PushCommit struct { |
|
|
|
Message string |
|
|
|
Message string |
|
|
|
AuthorEmail string |
|
|
|
AuthorEmail string |
|
|
|
AuthorName string |
|
|
|
AuthorName string |
|
|
|
|
|
|
|
Timestamp time.Time |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
type PushCommits struct { |
|
|
|
type PushCommits struct { |
|
|
@ -256,21 +257,22 @@ func NewPushCommits() *PushCommits { |
|
|
|
|
|
|
|
|
|
|
|
func (pc *PushCommits) ToApiPayloadCommits(repoLink string) []*api.PayloadCommit { |
|
|
|
func (pc *PushCommits) ToApiPayloadCommits(repoLink string) []*api.PayloadCommit { |
|
|
|
commits := make([]*api.PayloadCommit, len(pc.Commits)) |
|
|
|
commits := make([]*api.PayloadCommit, len(pc.Commits)) |
|
|
|
for i, cmt := range pc.Commits { |
|
|
|
for i, commit := range pc.Commits { |
|
|
|
author_username := "" |
|
|
|
authorUsername := "" |
|
|
|
author, err := GetUserByEmail(cmt.AuthorEmail) |
|
|
|
author, err := GetUserByEmail(commit.AuthorEmail) |
|
|
|
if err == nil { |
|
|
|
if err == nil { |
|
|
|
author_username = author.Name |
|
|
|
authorUsername = author.Name |
|
|
|
} |
|
|
|
} |
|
|
|
commits[i] = &api.PayloadCommit{ |
|
|
|
commits[i] = &api.PayloadCommit{ |
|
|
|
ID: cmt.Sha1, |
|
|
|
ID: commit.Sha1, |
|
|
|
Message: cmt.Message, |
|
|
|
Message: commit.Message, |
|
|
|
URL: fmt.Sprintf("%s/commit/%s", repoLink, cmt.Sha1), |
|
|
|
URL: fmt.Sprintf("%s/commit/%s", repoLink, commit.Sha1), |
|
|
|
Author: &api.PayloadAuthor{ |
|
|
|
Author: &api.PayloadAuthor{ |
|
|
|
Name: cmt.AuthorName, |
|
|
|
Name: commit.AuthorName, |
|
|
|
Email: cmt.AuthorEmail, |
|
|
|
Email: commit.AuthorEmail, |
|
|
|
UserName: author_username, |
|
|
|
UserName: authorUsername, |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
Timestamp: commit.Timestamp, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return commits |
|
|
|
return commits |
|
|
|