0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-22 02:04:16 +01:00

#2907 Add commit timestamp to webhook

This commit is contained in:
Unknwon 2016-08-09 18:28:06 -07:00
parent edd786446c
commit c5d4a9e046
5 changed files with 21 additions and 17 deletions

View file

@ -19,7 +19,7 @@ github.com/go-xorm/xorm = commit:b8b1711
github.com/gogits/chardet = commit:2404f77
github.com/gogits/cron = commit:96040e4
github.com/gogits/git-module = commit:18dd87d
github.com/gogits/go-gogs-client = commit:d725743
github.com/gogits/go-gogs-client = commit:d1020b4
github.com/issue9/identicon = commit:d36b545
github.com/jaytaylor/html2text = commit:52d9b78
github.com/kardianos/minwinsvc = commit:cad6b2b

View file

@ -88,7 +88,7 @@ func checkVersion() {
{"gopkg.in/ini.v1", ini.Version, "1.8.4"},
{"gopkg.in/macaron.v1", macaron.Version, "1.1.7"},
{"github.com/gogits/git-module", git.Version, "0.3.4"},
{"github.com/gogits/go-gogs-client", gogs.Version, "0.10.1"},
{"github.com/gogits/go-gogs-client", gogs.Version, "0.10.3"},
}
for _, c := range checkers {
if !version.Compare(c.Version(), c.Expected, ">=") {

2
glide.lock generated
View file

@ -43,7 +43,7 @@ imports:
- name: github.com/gogits/git-module
version: 18dd87dc5eac9ee7076133c8363803f2192d5713
- name: github.com/gogits/go-gogs-client
version: d725743594dfcd8eea25024f8456c9c103dadb1a
version: d1020b4da5474f7533f5b11084dcfd5536cf2e71
- name: github.com/issue9/identicon
version: d36b54562f4cf70c83653e13dc95c220c79ef521
- name: github.com/jaytaylor/html2text

View file

@ -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

View file

@ -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}