aboutsummaryrefslogtreecommitdiffstats
path: root/routers/repo
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-11-02 06:51:22 +0800
committerzeripath <art27@cantab.net>2019-11-01 22:51:22 +0000
commit0e7f7df3cf176640c66ddf286ec052c7c13beb8a (patch)
tree16afa02dd0b3df428aa7d9daadd4796eef907332 /routers/repo
parentba336f6f456835f1f327ee967991079dd220266d (diff)
downloadgitea-0e7f7df3cf176640c66ddf286ec052c7c13beb8a.tar.gz
gitea-0e7f7df3cf176640c66ddf286ec052c7c13beb8a.zip
Move webhook to a standalone package under modules (#8747)
* Move webhook to a standalone package under modules * fix test * fix comments
Diffstat (limited to 'routers/repo')
-rw-r--r--routers/repo/pull.go3
-rw-r--r--routers/repo/webhook.go5
2 files changed, 5 insertions, 3 deletions
diff --git a/routers/repo/pull.go b/routers/repo/pull.go
index 3defd04b1b..d28ee0cfaf 100644
--- a/routers/repo/pull.go
+++ b/routers/repo/pull.go
@@ -23,6 +23,7 @@ import (
"code.gitea.io/gitea/modules/notification"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/util"
+ "code.gitea.io/gitea/modules/webhook"
"code.gitea.io/gitea/services/gitdiff"
pull_service "code.gitea.io/gitea/services/pull"
repo_service "code.gitea.io/gitea/services/repository"
@@ -823,7 +824,7 @@ func TriggerTask(ctx *context.Context) {
log.Trace("TriggerTask '%s/%s' by %s", repo.Name, branch, pusher.Name)
- go models.HookQueue.Add(repo.ID)
+ go webhook.HookQueue.Add(repo.ID)
go pull_service.AddTestPullRequestTask(pusher, repo.ID, branch, true)
ctx.Status(202)
}
diff --git a/routers/repo/webhook.go b/routers/repo/webhook.go
index 48b4e7afff..f89bce8190 100644
--- a/routers/repo/webhook.go
+++ b/routers/repo/webhook.go
@@ -19,6 +19,7 @@ import (
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
+ "code.gitea.io/gitea/modules/webhook"
"github.com/unknwon/com"
)
@@ -864,11 +865,11 @@ func TestWebhook(ctx *context.Context) {
Pusher: apiUser,
Sender: apiUser,
}
- if err := models.PrepareWebhook(w, ctx.Repo.Repository, models.HookEventPush, p); err != nil {
+ if err := webhook.PrepareWebhook(w, ctx.Repo.Repository, models.HookEventPush, p); err != nil {
ctx.Flash.Error("PrepareWebhook: " + err.Error())
ctx.Status(500)
} else {
- go models.HookQueue.Add(ctx.Repo.Repository.ID)
+ go webhook.HookQueue.Add(ctx.Repo.Repository.ID)
ctx.Flash.Info(ctx.Tr("repo.settings.webhook.test_delivery_success"))
ctx.Status(200)
}