aboutsummaryrefslogtreecommitdiffstats
path: root/routers/repo/webhook.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-08-14 04:17:26 -0700
committerUnknwon <u@gogs.io>2016-08-14 04:17:26 -0700
commitdccb0c15b996ac4dc0307cbfed140ce1558d7e3c (patch)
tree97593eae3a1023296c2c03258e6bc4ae4c02b6bf /routers/repo/webhook.go
parent3f7f4852efaaa56a0dada832dc652a1fc8869ae7 (diff)
downloadgitea-dccb0c15b996ac4dc0307cbfed140ce1558d7e3c.tar.gz
gitea-dccb0c15b996ac4dc0307cbfed140ce1558d7e3c.zip
Replace convert.To with APIFormat calls
Diffstat (limited to 'routers/repo/webhook.go')
-rw-r--r--routers/repo/webhook.go19
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())