diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2019-11-02 06:51:22 +0800 |
---|---|---|
committer | zeripath <art27@cantab.net> | 2019-11-01 22:51:22 +0000 |
commit | 0e7f7df3cf176640c66ddf286ec052c7c13beb8a (patch) | |
tree | 16afa02dd0b3df428aa7d9daadd4796eef907332 /routers/api/v1/repo | |
parent | ba336f6f456835f1f327ee967991079dd220266d (diff) | |
download | gitea-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/api/v1/repo')
-rw-r--r-- | routers/api/v1/repo/hook.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/routers/api/v1/repo/hook.go b/routers/api/v1/repo/hook.go index 5c71262560..56fc514508 100644 --- a/routers/api/v1/repo/hook.go +++ b/routers/api/v1/repo/hook.go @@ -9,6 +9,7 @@ import ( "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/git" api "code.gitea.io/gitea/modules/structs" + "code.gitea.io/gitea/modules/webhook" "code.gitea.io/gitea/routers/api/v1/convert" "code.gitea.io/gitea/routers/api/v1/utils" ) @@ -122,7 +123,7 @@ func TestHook(ctx *context.APIContext) { return } - if err := models.PrepareWebhook(hook, ctx.Repo.Repository, models.HookEventPush, &api.PushPayload{ + if err := webhook.PrepareWebhook(hook, ctx.Repo.Repository, models.HookEventPush, &api.PushPayload{ Ref: git.BranchPrefix + ctx.Repo.Repository.DefaultBranch, Before: ctx.Repo.Commit.ID.String(), After: ctx.Repo.Commit.ID.String(), @@ -136,7 +137,7 @@ func TestHook(ctx *context.APIContext) { ctx.Error(500, "PrepareWebhook: ", err) return } - go models.HookQueue.Add(ctx.Repo.Repository.ID) + go webhook.HookQueue.Add(ctx.Repo.Repository.ID) ctx.Status(204) } |