aboutsummaryrefslogtreecommitdiffstats
path: root/modules/notification/webhook/webhook.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-10-29 00:45:43 +0800
committerGitHub <noreply@github.com>2019-10-29 00:45:43 +0800
commitaf8957bc4ce78613fe03cb1abc6c961dd67ff344 (patch)
treeb17b15eddca01c46d53d38abf184a2450e557de4 /modules/notification/webhook/webhook.go
parente3875ace913ca428804acc9a9ee1cd0b06cd8026 (diff)
downloadgitea-af8957bc4ce78613fe03cb1abc6c961dd67ff344.tar.gz
gitea-af8957bc4ce78613fe03cb1abc6c961dd67ff344.zip
Move issue notifications (#8713)
Diffstat (limited to 'modules/notification/webhook/webhook.go')
-rw-r--r--modules/notification/webhook/webhook.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/modules/notification/webhook/webhook.go b/modules/notification/webhook/webhook.go
index 1ee8473dd6..bd7c8b29d3 100644
--- a/modules/notification/webhook/webhook.go
+++ b/modules/notification/webhook/webhook.go
@@ -262,3 +262,18 @@ func (m *webhookNotifier) NotifyIssueChangeStatus(doer *models.User, issue *mode
go models.HookQueue.Add(issue.Repo.ID)
}
}
+
+func (m *webhookNotifier) NotifyNewIssue(issue *models.Issue) {
+ mode, _ := models.AccessLevel(issue.Poster, issue.Repo)
+ if err := models.PrepareWebhooks(issue.Repo, models.HookEventIssues, &api.IssuePayload{
+ Action: api.HookIssueOpened,
+ Index: issue.Index,
+ Issue: issue.APIFormat(),
+ Repository: issue.Repo.APIFormat(mode),
+ Sender: issue.Poster.APIFormat(),
+ }); err != nil {
+ log.Error("PrepareWebhooks: %v", err)
+ } else {
+ go models.HookQueue.Add(issue.RepoID)
+ }
+}