Move webhook to a standalone package under modules (#8747)

* Move webhook to a standalone package under modules

* fix test

* fix comments
This commit is contained in:
2019-11-02 06:51:22 +08:00
committed by zeripath
parent ba336f6f45
commit 0e7f7df3cf
20 changed files with 570 additions and 478 deletions

View File

@ -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)
}