Move issue notifications (#8713)

This commit is contained in:
Lunny Xiao 2019-10-29 00:45:43 +08:00 committed by GitHub
parent e3875ace91
commit af8957bc4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 35 additions and 55 deletions

View file

@ -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)
}
}