diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2019-11-02 06:51:22 +0800 |
---|---|---|
committer | zeripath <art27@cantab.net> | 2019-11-01 22:51:22 +0000 |
commit | 0e7f7df3cf176640c66ddf286ec052c7c13beb8a (patch) | |
tree | 16afa02dd0b3df428aa7d9daadd4796eef907332 /services/release/release.go | |
parent | ba336f6f456835f1f327ee967991079dd220266d (diff) | |
download | gitea-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 'services/release/release.go')
-rw-r--r-- | services/release/release.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/services/release/release.go b/services/release/release.go index b4f814a77f..42db1f3417 100644 --- a/services/release/release.go +++ b/services/release/release.go @@ -15,6 +15,7 @@ import ( "code.gitea.io/gitea/modules/process" api "code.gitea.io/gitea/modules/structs" "code.gitea.io/gitea/modules/timeutil" + "code.gitea.io/gitea/modules/webhook" ) func createTag(gitRepo *git.Repository, rel *models.Release) error { @@ -84,7 +85,7 @@ func CreateRelease(gitRepo *git.Repository, rel *models.Release, attachmentUUIDs log.Error("LoadAttributes: %v", err) } else { mode, _ := models.AccessLevel(rel.Publisher, rel.Repo) - if err := models.PrepareWebhooks(rel.Repo, models.HookEventRelease, &api.ReleasePayload{ + if err := webhook.PrepareWebhooks(rel.Repo, models.HookEventRelease, &api.ReleasePayload{ Action: api.HookReleasePublished, Release: rel.APIFormat(), Repository: rel.Repo.APIFormat(mode), @@ -92,7 +93,7 @@ func CreateRelease(gitRepo *git.Repository, rel *models.Release, attachmentUUIDs }); err != nil { log.Error("PrepareWebhooks: %v", err) } else { - go models.HookQueue.Add(rel.Repo.ID) + go webhook.HookQueue.Add(rel.Repo.ID) } } } @@ -121,7 +122,7 @@ func UpdateRelease(doer *models.User, gitRepo *git.Repository, rel *models.Relea // even if attachments added failed, hooks will be still triggered mode, _ := models.AccessLevel(doer, rel.Repo) - if err1 := models.PrepareWebhooks(rel.Repo, models.HookEventRelease, &api.ReleasePayload{ + if err1 := webhook.PrepareWebhooks(rel.Repo, models.HookEventRelease, &api.ReleasePayload{ Action: api.HookReleaseUpdated, Release: rel.APIFormat(), Repository: rel.Repo.APIFormat(mode), @@ -129,7 +130,7 @@ func UpdateRelease(doer *models.User, gitRepo *git.Repository, rel *models.Relea }); err1 != nil { log.Error("PrepareWebhooks: %v", err) } else { - go models.HookQueue.Add(rel.Repo.ID) + go webhook.HookQueue.Add(rel.Repo.ID) } return err @@ -187,7 +188,7 @@ func DeleteReleaseByID(id int64, doer *models.User, delTag bool) error { } mode, _ := models.AccessLevel(doer, rel.Repo) - if err := models.PrepareWebhooks(rel.Repo, models.HookEventRelease, &api.ReleasePayload{ + if err := webhook.PrepareWebhooks(rel.Repo, models.HookEventRelease, &api.ReleasePayload{ Action: api.HookReleaseDeleted, Release: rel.APIFormat(), Repository: rel.Repo.APIFormat(mode), @@ -195,7 +196,7 @@ func DeleteReleaseByID(id int64, doer *models.User, delTag bool) error { }); err != nil { log.Error("PrepareWebhooks: %v", err) } else { - go models.HookQueue.Add(rel.Repo.ID) + go webhook.HookQueue.Add(rel.Repo.ID) } return nil |