mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
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:
@@ -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)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user