1
0
Fork 0
forked from forgejo/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:
Lunny Xiao 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

@ -11,6 +11,7 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/webhook"
)
func syncAction(opType models.ActionType, repo *models.Repository, refName string, data []byte) error {
@ -28,7 +29,7 @@ func syncAction(opType models.ActionType, repo *models.Repository, refName strin
}
defer func() {
go models.HookQueue.Add(repo.ID)
go webhook.HookQueue.Add(repo.ID)
}()
return nil
@ -55,7 +56,7 @@ func SyncPushAction(repo *models.Repository, opts SyncPushActionOptions) error {
opts.Commits.CompareURL = repo.ComposeCompareURL(opts.OldCommitID, opts.NewCommitID)
apiPusher := repo.MustOwner().APIFormat()
if err := models.PrepareWebhooks(repo, models.HookEventPush, &api.PushPayload{
if err := webhook.PrepareWebhooks(repo, models.HookEventPush, &api.PushPayload{
Ref: opts.RefName,
Before: opts.OldCommitID,
After: opts.NewCommitID,