aboutsummaryrefslogtreecommitdiffstats
path: root/modules/repofiles
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-11-02 06:51:22 +0800
committerzeripath <art27@cantab.net>2019-11-01 22:51:22 +0000
commit0e7f7df3cf176640c66ddf286ec052c7c13beb8a (patch)
tree16afa02dd0b3df428aa7d9daadd4796eef907332 /modules/repofiles
parentba336f6f456835f1f327ee967991079dd220266d (diff)
downloadgitea-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 'modules/repofiles')
-rw-r--r--modules/repofiles/action.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/modules/repofiles/action.go b/modules/repofiles/action.go
index 9467e4fb72..addbdb464c 100644
--- a/modules/repofiles/action.go
+++ b/modules/repofiles/action.go
@@ -14,6 +14,7 @@ import (
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
+ "code.gitea.io/gitea/modules/webhook"
)
// CommitRepoActionOptions represent options of a new commit action.
@@ -112,7 +113,7 @@ func CommitRepoAction(opts CommitRepoActionOptions) error {
}
defer func() {
- go models.HookQueue.Add(repo.ID)
+ go webhook.HookQueue.Add(repo.ID)
}()
apiPusher := pusher.APIFormat()
@@ -134,7 +135,7 @@ func CommitRepoAction(opts CommitRepoActionOptions) error {
if err != nil {
log.Error("GetBranchCommitID[%s]: %v", opts.RefFullName, err)
}
- if err = models.PrepareWebhooks(repo, models.HookEventCreate, &api.CreatePayload{
+ if err = webhook.PrepareWebhooks(repo, models.HookEventCreate, &api.CreatePayload{
Ref: refName,
Sha: shaSum,
RefType: "branch",
@@ -148,7 +149,7 @@ func CommitRepoAction(opts CommitRepoActionOptions) error {
case models.ActionDeleteBranch: // Delete Branch
isHookEventPush = true
- if err = models.PrepareWebhooks(repo, models.HookEventDelete, &api.DeletePayload{
+ if err = webhook.PrepareWebhooks(repo, models.HookEventDelete, &api.DeletePayload{
Ref: refName,
RefType: "branch",
PusherType: api.PusherTypeUser,
@@ -169,7 +170,7 @@ func CommitRepoAction(opts CommitRepoActionOptions) error {
if err != nil {
log.Error("GetTagCommitID[%s]: %v", opts.RefFullName, err)
}
- if err = models.PrepareWebhooks(repo, models.HookEventCreate, &api.CreatePayload{
+ if err = webhook.PrepareWebhooks(repo, models.HookEventCreate, &api.CreatePayload{
Ref: refName,
Sha: shaSum,
RefType: "tag",
@@ -181,7 +182,7 @@ func CommitRepoAction(opts CommitRepoActionOptions) error {
case models.ActionDeleteTag: // Delete Tag
isHookEventPush = true
- if err = models.PrepareWebhooks(repo, models.HookEventDelete, &api.DeletePayload{
+ if err = webhook.PrepareWebhooks(repo, models.HookEventDelete, &api.DeletePayload{
Ref: refName,
RefType: "tag",
PusherType: api.PusherTypeUser,
@@ -197,7 +198,7 @@ func CommitRepoAction(opts CommitRepoActionOptions) error {
if err != nil {
return err
}
- if err = models.PrepareWebhooks(repo, models.HookEventPush, &api.PushPayload{
+ if err = webhook.PrepareWebhooks(repo, models.HookEventPush, &api.PushPayload{
Ref: opts.RefFullName,
Before: opts.OldCommitID,
After: opts.NewCommitID,