From 0e7f7df3cf176640c66ddf286ec052c7c13beb8a Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sat, 2 Nov 2019 06:51:22 +0800 Subject: Move webhook to a standalone package under modules (#8747) * Move webhook to a standalone package under modules * fix test * fix comments --- services/issue/label.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'services/issue/label.go') diff --git a/services/issue/label.go b/services/issue/label.go index b393e5d38c..bb36d58492 100644 --- a/services/issue/label.go +++ b/services/issue/label.go @@ -9,6 +9,7 @@ import ( "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/notification" api "code.gitea.io/gitea/modules/structs" + "code.gitea.io/gitea/modules/webhook" ) func sendLabelUpdatedWebhook(issue *models.Issue, doer *models.User) { @@ -34,7 +35,7 @@ func sendLabelUpdatedWebhook(issue *models.Issue, doer *models.User) { log.Error("LoadIssue: %v", err) return } - err = models.PrepareWebhooks(issue.Repo, models.HookEventPullRequest, &api.PullRequestPayload{ + err = webhook.PrepareWebhooks(issue.Repo, models.HookEventPullRequest, &api.PullRequestPayload{ Action: api.HookIssueLabelUpdated, Index: issue.Index, PullRequest: issue.PullRequest.APIFormat(), @@ -42,7 +43,7 @@ func sendLabelUpdatedWebhook(issue *models.Issue, doer *models.User) { Sender: doer.APIFormat(), }) } else { - err = models.PrepareWebhooks(issue.Repo, models.HookEventIssues, &api.IssuePayload{ + err = webhook.PrepareWebhooks(issue.Repo, models.HookEventIssues, &api.IssuePayload{ Action: api.HookIssueLabelUpdated, Index: issue.Index, Issue: issue.APIFormat(), @@ -53,7 +54,7 @@ func sendLabelUpdatedWebhook(issue *models.Issue, doer *models.User) { if err != nil { log.Error("PrepareWebhooks [is_pull: %v]: %v", issue.IsPull, err) } else { - go models.HookQueue.Add(issue.RepoID) + go webhook.HookQueue.Add(issue.RepoID) } } -- cgit v1.2.3