diff options
Diffstat (limited to 'models')
-rw-r--r-- | models/action.go | 22 | ||||
-rw-r--r-- | models/update.go | 10 |
2 files changed, 18 insertions, 14 deletions
diff --git a/models/action.go b/models/action.go index 081f96bb..4f57d1b3 100644 --- a/models/action.go +++ b/models/action.go @@ -238,6 +238,7 @@ type PushCommit struct { Message string AuthorEmail string AuthorName string + Timestamp time.Time } type PushCommits struct { @@ -256,21 +257,22 @@ func NewPushCommits() *PushCommits { func (pc *PushCommits) ToApiPayloadCommits(repoLink string) []*api.PayloadCommit { commits := make([]*api.PayloadCommit, len(pc.Commits)) - for i, cmt := range pc.Commits { - author_username := "" - author, err := GetUserByEmail(cmt.AuthorEmail) + for i, commit := range pc.Commits { + authorUsername := "" + author, err := GetUserByEmail(commit.AuthorEmail) if err == nil { - author_username = author.Name + authorUsername = author.Name } commits[i] = &api.PayloadCommit{ - ID: cmt.Sha1, - Message: cmt.Message, - URL: fmt.Sprintf("%s/commit/%s", repoLink, cmt.Sha1), + ID: commit.Sha1, + Message: commit.Message, + URL: fmt.Sprintf("%s/commit/%s", repoLink, commit.Sha1), Author: &api.PayloadAuthor{ - Name: cmt.AuthorName, - Email: cmt.AuthorEmail, - UserName: author_username, + Name: commit.AuthorName, + Email: commit.AuthorEmail, + UserName: authorUsername, }, + Timestamp: commit.Timestamp, } } return commits diff --git a/models/update.go b/models/update.go index 14e5b28c..9b2078c9 100644 --- a/models/update.go +++ b/models/update.go @@ -56,10 +56,12 @@ func ListToPushCommits(l *list.List) *PushCommits { actEmail = commit.Committer.Email } commits = append(commits, - &PushCommit{commit.ID.String(), - commit.Message(), - commit.Author.Email, - commit.Author.Name, + &PushCommit{ + Sha1: commit.ID.String(), + Message: commit.Message(), + AuthorEmail: commit.Author.Email, + AuthorName: commit.Author.Name, + Timestamp: commit.Author.When, }) } return &PushCommits{l.Len(), commits, "", nil} |