aboutsummaryrefslogtreecommitdiff
path: root/routers
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2017-03-16 17:33:04 -0400
committerUnknwon <u@gogs.io>2017-03-16 17:33:04 -0400
commit9e8ffa14cb980221c35bb1431e97849a51e09dd7 (patch)
treeafcd3eb02076a4d6c4d171818123589aa3efa29c /routers
parent0ccd7c97abcb1ae314c9c17b0c08863cb13115fa (diff)
webhook: add file status to push event (#3897)
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/webhook.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/routers/repo/webhook.go b/routers/repo/webhook.go
index 73bd8786..ce142295 100644
--- a/routers/repo/webhook.go
+++ b/routers/repo/webhook.go
@@ -484,6 +484,13 @@ func TestWebhook(ctx *context.Context) {
}
}
+ fileStatus, err := commit.FileStatus()
+ if err != nil {
+ ctx.Flash.Error("FileStatus: " + err.Error())
+ ctx.Status(500)
+ return
+ }
+
apiUser := ctx.User.APIFormat()
p := &api.PushPayload{
Ref: git.BRANCH_PREFIX + ctx.Repo.Repository.DefaultBranch,
@@ -504,6 +511,9 @@ func TestWebhook(ctx *context.Context) {
Email: commit.Committer.Email,
UserName: committerUsername,
},
+ Added: fileStatus.Added,
+ Removed: fileStatus.Removed,
+ Modified: fileStatus.Modified,
},
},
Repo: ctx.Repo.Repository.APIFormat(nil),
@@ -514,7 +524,6 @@ func TestWebhook(ctx *context.Context) {
ctx.Flash.Error("TestWebhook: " + err.Error())
ctx.Status(500)
} else {
- go models.HookQueue.Add(ctx.Repo.Repository.ID)
ctx.Flash.Info(ctx.Tr("repo.settings.webhook.test_delivery_success"))
ctx.Status(200)
}