forked from kevadesu/forgejo
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:
parent
ba336f6f45
commit
0e7f7df3cf
20 changed files with 570 additions and 478 deletions
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue