mirror of
https://github.com/go-gitea/gitea
synced 2025-07-19 16:58:37 +00:00
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
@@ -51,7 +51,7 @@ func (ns *notificationService) Run() {
|
||||
}
|
||||
|
||||
func (ns *notificationService) NotifyCreateIssueComment(doer *models.User, repo *models.Repository,
|
||||
issue *models.Issue, comment *models.Comment) {
|
||||
issue *models.Issue, comment *models.Comment, mentions []*models.User) {
|
||||
var opts = issueNotificationOpts{
|
||||
IssueID: issue.ID,
|
||||
NotificationAuthorID: doer.ID,
|
||||
@@ -60,13 +60,31 @@ func (ns *notificationService) NotifyCreateIssueComment(doer *models.User, repo
|
||||
opts.CommentID = comment.ID
|
||||
}
|
||||
_ = ns.issueQueue.Push(opts)
|
||||
for _, mention := range mentions {
|
||||
var opts = issueNotificationOpts{
|
||||
IssueID: issue.ID,
|
||||
NotificationAuthorID: doer.ID,
|
||||
ReceiverID: mention.ID,
|
||||
}
|
||||
if comment != nil {
|
||||
opts.CommentID = comment.ID
|
||||
}
|
||||
_ = ns.issueQueue.Push(opts)
|
||||
}
|
||||
}
|
||||
|
||||
func (ns *notificationService) NotifyNewIssue(issue *models.Issue) {
|
||||
func (ns *notificationService) NotifyNewIssue(issue *models.Issue, mentions []*models.User) {
|
||||
_ = ns.issueQueue.Push(issueNotificationOpts{
|
||||
IssueID: issue.ID,
|
||||
NotificationAuthorID: issue.Poster.ID,
|
||||
})
|
||||
for _, mention := range mentions {
|
||||
_ = ns.issueQueue.Push(issueNotificationOpts{
|
||||
IssueID: issue.ID,
|
||||
NotificationAuthorID: issue.Poster.ID,
|
||||
ReceiverID: mention.ID,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (ns *notificationService) NotifyIssueChangeStatus(doer *models.User, issue *models.Issue, actionComment *models.Comment, isClosed bool) {
|
||||
@@ -83,7 +101,7 @@ func (ns *notificationService) NotifyMergePullRequest(pr *models.PullRequest, do
|
||||
})
|
||||
}
|
||||
|
||||
func (ns *notificationService) NotifyNewPullRequest(pr *models.PullRequest) {
|
||||
func (ns *notificationService) NotifyNewPullRequest(pr *models.PullRequest, mentions []*models.User) {
|
||||
if err := pr.LoadIssue(); err != nil {
|
||||
log.Error("Unable to load issue: %d for pr: %d: Error: %v", pr.IssueID, pr.ID, err)
|
||||
return
|
||||
@@ -92,9 +110,16 @@ func (ns *notificationService) NotifyNewPullRequest(pr *models.PullRequest) {
|
||||
IssueID: pr.Issue.ID,
|
||||
NotificationAuthorID: pr.Issue.PosterID,
|
||||
})
|
||||
for _, mention := range mentions {
|
||||
_ = ns.issueQueue.Push(issueNotificationOpts{
|
||||
IssueID: pr.Issue.ID,
|
||||
NotificationAuthorID: pr.Issue.PosterID,
|
||||
ReceiverID: mention.ID,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (ns *notificationService) NotifyPullRequestReview(pr *models.PullRequest, r *models.Review, c *models.Comment) {
|
||||
func (ns *notificationService) NotifyPullRequestReview(pr *models.PullRequest, r *models.Review, c *models.Comment, mentions []*models.User) {
|
||||
var opts = issueNotificationOpts{
|
||||
IssueID: pr.Issue.ID,
|
||||
NotificationAuthorID: r.Reviewer.ID,
|
||||
@@ -103,6 +128,28 @@ func (ns *notificationService) NotifyPullRequestReview(pr *models.PullRequest, r
|
||||
opts.CommentID = c.ID
|
||||
}
|
||||
_ = ns.issueQueue.Push(opts)
|
||||
for _, mention := range mentions {
|
||||
var opts = issueNotificationOpts{
|
||||
IssueID: pr.Issue.ID,
|
||||
NotificationAuthorID: r.Reviewer.ID,
|
||||
ReceiverID: mention.ID,
|
||||
}
|
||||
if c != nil {
|
||||
opts.CommentID = c.ID
|
||||
}
|
||||
_ = ns.issueQueue.Push(opts)
|
||||
}
|
||||
}
|
||||
|
||||
func (ns *notificationService) NotifyPullRequestCodeComment(pr *models.PullRequest, c *models.Comment, mentions []*models.User) {
|
||||
for _, mention := range mentions {
|
||||
_ = ns.issueQueue.Push(issueNotificationOpts{
|
||||
IssueID: pr.Issue.ID,
|
||||
NotificationAuthorID: c.Poster.ID,
|
||||
CommentID: c.ID,
|
||||
ReceiverID: mention.ID,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (ns *notificationService) NotifyPullRequestPushCommits(doer *models.User, pr *models.PullRequest, comment *models.Comment) {
|
||||
|
Reference in New Issue
Block a user