summaryrefslogtreecommitdiffstats
path: root/models/action.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-08-09 18:28:06 -0700
committerUnknwon <u@gogs.io>2016-08-09 18:28:06 -0700
commitc5d4a9e046045f949ec9606b49dc37b928e83fb3 (patch)
tree95269c1d60654c35d5c927cd34998d5add56ebf9 /models/action.go
parentedd786446c0f7a1581be08dbe7697c339790c2c1 (diff)
downloadgitea-c5d4a9e046045f949ec9606b49dc37b928e83fb3.tar.gz
gitea-c5d4a9e046045f949ec9606b49dc37b928e83fb3.zip
#2907 Add commit timestamp to webhook
Diffstat (limited to 'models/action.go')
-rw-r--r--models/action.go22
1 files changed, 12 insertions, 10 deletions
diff --git a/models/action.go b/models/action.go
index 081f96bb2a..4f57d1b3b5 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