#2907 Add commit timestamp to webhook
This commit is contained in:
parent
edd786446c
commit
c5d4a9e046
|
@ -19,7 +19,7 @@ github.com/go-xorm/xorm = commit:b8b1711
|
||||||
github.com/gogits/chardet = commit:2404f77
|
github.com/gogits/chardet = commit:2404f77
|
||||||
github.com/gogits/cron = commit:96040e4
|
github.com/gogits/cron = commit:96040e4
|
||||||
github.com/gogits/git-module = commit:18dd87d
|
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/issue9/identicon = commit:d36b545
|
||||||
github.com/jaytaylor/html2text = commit:52d9b78
|
github.com/jaytaylor/html2text = commit:52d9b78
|
||||||
github.com/kardianos/minwinsvc = commit:cad6b2b
|
github.com/kardianos/minwinsvc = commit:cad6b2b
|
||||||
|
|
|
@ -88,7 +88,7 @@ func checkVersion() {
|
||||||
{"gopkg.in/ini.v1", ini.Version, "1.8.4"},
|
{"gopkg.in/ini.v1", ini.Version, "1.8.4"},
|
||||||
{"gopkg.in/macaron.v1", macaron.Version, "1.1.7"},
|
{"gopkg.in/macaron.v1", macaron.Version, "1.1.7"},
|
||||||
{"github.com/gogits/git-module", git.Version, "0.3.4"},
|
{"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 {
|
for _, c := range checkers {
|
||||||
if !version.Compare(c.Version(), c.Expected, ">=") {
|
if !version.Compare(c.Version(), c.Expected, ">=") {
|
||||||
|
|
2
glide.lock
generated
2
glide.lock
generated
|
@ -43,7 +43,7 @@ imports:
|
||||||
- name: github.com/gogits/git-module
|
- name: github.com/gogits/git-module
|
||||||
version: 18dd87dc5eac9ee7076133c8363803f2192d5713
|
version: 18dd87dc5eac9ee7076133c8363803f2192d5713
|
||||||
- name: github.com/gogits/go-gogs-client
|
- name: github.com/gogits/go-gogs-client
|
||||||
version: d725743594dfcd8eea25024f8456c9c103dadb1a
|
version: d1020b4da5474f7533f5b11084dcfd5536cf2e71
|
||||||
- name: github.com/issue9/identicon
|
- name: github.com/issue9/identicon
|
||||||
version: d36b54562f4cf70c83653e13dc95c220c79ef521
|
version: d36b54562f4cf70c83653e13dc95c220c79ef521
|
||||||
- name: github.com/jaytaylor/html2text
|
- name: github.com/jaytaylor/html2text
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -56,10 +56,12 @@ func ListToPushCommits(l *list.List) *PushCommits {
|
||||||
actEmail = commit.Committer.Email
|
actEmail = commit.Committer.Email
|
||||||
}
|
}
|
||||||
commits = append(commits,
|
commits = append(commits,
|
||||||
&PushCommit{commit.ID.String(),
|
&PushCommit{
|
||||||
commit.Message(),
|
Sha1: commit.ID.String(),
|
||||||
commit.Author.Email,
|
Message: commit.Message(),
|
||||||
commit.Author.Name,
|
AuthorEmail: commit.Author.Email,
|
||||||
|
AuthorName: commit.Author.Name,
|
||||||
|
Timestamp: commit.Author.When,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return &PushCommits{l.Len(), commits, "", nil}
|
return &PushCommits{l.Len(), commits, "", nil}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user