aboutsummaryrefslogtreecommitdiffstats
path: root/routers/repo
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
parent3f7f4852efaaa56a0dada832dc652a1fc8869ae7 (diff)
downloadgitea-dccb0c15b996ac4dc0307cbfed140ce1558d7e3c.tar.gz
gitea-dccb0c15b996ac4dc0307cbfed140ce1558d7e3c.zip
Replace convert.To with APIFormat calls
Diffstat (limited to 'routers/repo')
-rw-r--r--routers/repo/http.go4
-rw-r--r--routers/repo/webhook.go19
2 files changed, 9 insertions, 14 deletions
diff --git a/routers/repo/http.go b/routers/repo/http.go
index 0615143e38..89a9b1b9ee 100644
--- a/routers/repo/http.go
+++ b/routers/repo/http.go
@@ -20,6 +20,8 @@ import (
"strings"
"time"
+ git "github.com/gogits/git-module"
+
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/base"
"github.com/gogits/gogs/modules/context"
@@ -206,7 +208,7 @@ func HTTP(ctx *context.Context) {
RepoName: reponame,
}); err == nil {
go models.HookQueue.Add(repo.ID)
- go models.AddTestPullRequestTask(authUser, repo.ID, strings.TrimPrefix(refName, "refs/heads/"), true)
+ go models.AddTestPullRequestTask(authUser, repo.ID, strings.TrimPrefix(refName, git.BRANCH_PREFIX), true)
}
}
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())