diff options
Diffstat (limited to 'modules/notification/webhook/webhook.go')
-rw-r--r-- | modules/notification/webhook/webhook.go | 15 |
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) + } +} |