From 9e8ffa14cb980221c35bb1431e97849a51e09dd7 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Thu, 16 Mar 2017 17:33:04 -0400 Subject: webhook: add file status to push event (#3897) --- routers/repo/webhook.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'routers') 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) } -- cgit v1.2.3