diff options
Diffstat (limited to 'routers/repo/webhook.go')
-rw-r--r-- | routers/repo/webhook.go | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/routers/repo/webhook.go b/routers/repo/webhook.go index 9b4c33e4b6..8f6ee3f06c 100644 --- a/routers/repo/webhook.go +++ b/routers/repo/webhook.go @@ -347,6 +347,7 @@ func SlackHooksEditPost(ctx *context.Context, form auth.NewSlackHookForm) { } func TestWebhook(ctx *context.Context) { + apiUser := ctx.User.APIFormat() p := &api.PushPayload{ Ref: git.BRANCH_PREFIX + ctx.Repo.Repository.DefaultBranch, Before: ctx.Repo.CommitID, @@ -356,27 +357,19 @@ func TestWebhook(ctx *context.Context) { ID: ctx.Repo.CommitID, Message: ctx.Repo.Commit.Message(), URL: ctx.Repo.Repository.FullLink() + "/commit/" + ctx.Repo.CommitID, - Author: &api.PayloadAuthor{ + Author: &api.PayloadUser{ Name: ctx.Repo.Commit.Author.Name, Email: ctx.Repo.Commit.Author.Email, }, - Committer: &api.PayloadCommitter{ + Committer: &api.PayloadUser{ Name: ctx.Repo.Commit.Committer.Name, Email: ctx.Repo.Commit.Committer.Email, }, }, }, - Repo: ctx.Repo.Repository.ComposePayload(), - Pusher: &api.PayloadAuthor{ - Name: ctx.User.Name, - Email: ctx.User.Email, - UserName: ctx.User.Name, - }, - Sender: &api.PayloadUser{ - UserName: ctx.User.Name, - ID: ctx.User.ID, - AvatarUrl: ctx.User.AvatarLink(), - }, + Repo: ctx.Repo.Repository.APIFormat(nil), + Pusher: apiUser, + Sender: apiUser, } if err := models.PrepareWebhooks(ctx.Repo.Repository, models.HOOK_EVENT_PUSH, p); err != nil { ctx.Flash.Error("PrepareWebhooks: " + err.Error()) |