summaryrefslogtreecommitdiffstats
path: root/routers/web
diff options
context:
space:
mode:
Diffstat (limited to 'routers/web')
-rw-r--r--routers/web/repo/webhook.go44
1 files changed, 23 insertions, 21 deletions
diff --git a/routers/web/repo/webhook.go b/routers/web/repo/webhook.go
index ab254dbe46..e8d86db51d 100644
--- a/routers/web/repo/webhook.go
+++ b/routers/web/repo/webhook.go
@@ -1085,28 +1085,30 @@ func TestWebhook(ctx *context.Context) {
}
apiUser := convert.ToUserWithAccessMode(ctx.User, models.AccessModeNone)
- p := &api.PushPayload{
- Ref: git.BranchPrefix + ctx.Repo.Repository.DefaultBranch,
- Before: commit.ID.String(),
- After: commit.ID.String(),
- Commits: []*api.PayloadCommit{
- {
- ID: commit.ID.String(),
- Message: commit.Message(),
- URL: ctx.Repo.Repository.HTMLURL() + "/commit/" + commit.ID.String(),
- Author: &api.PayloadUser{
- Name: commit.Author.Name,
- Email: commit.Author.Email,
- },
- Committer: &api.PayloadUser{
- Name: commit.Committer.Name,
- Email: commit.Committer.Email,
- },
- },
+
+ apiCommit := &api.PayloadCommit{
+ ID: commit.ID.String(),
+ Message: commit.Message(),
+ URL: ctx.Repo.Repository.HTMLURL() + "/commit/" + commit.ID.String(),
+ Author: &api.PayloadUser{
+ Name: commit.Author.Name,
+ Email: commit.Author.Email,
+ },
+ Committer: &api.PayloadUser{
+ Name: commit.Committer.Name,
+ Email: commit.Committer.Email,
},
- Repo: convert.ToRepo(ctx.Repo.Repository, models.AccessModeNone),
- Pusher: apiUser,
- Sender: apiUser,
+ }
+
+ p := &api.PushPayload{
+ Ref: git.BranchPrefix + ctx.Repo.Repository.DefaultBranch,
+ Before: commit.ID.String(),
+ After: commit.ID.String(),
+ Commits: []*api.PayloadCommit{apiCommit},
+ HeadCommit: apiCommit,
+ Repo: convert.ToRepo(ctx.Repo.Repository, models.AccessModeNone),
+ Pusher: apiUser,
+ Sender: apiUser,
}
if err := webhook.PrepareWebhook(w, ctx.Repo.Repository, models.HookEventPush, p); err != nil {
ctx.Flash.Error("PrepareWebhook: " + err.Error())