ui.go (gitea-1.13.1) | : | ui.go (gitea-1.13.2) | ||
---|---|---|---|---|
skipping to change at line 54 | skipping to change at line 54 | |||
log.Error("Was unable to create issue notification: %v", err) | log.Error("Was unable to create issue notification: %v", err) | |||
} | } | |||
} | } | |||
} | } | |||
func (ns *notificationService) Run() { | func (ns *notificationService) Run() { | |||
graceful.GetManager().RunWithShutdownFns(ns.issueQueue.Run) | graceful.GetManager().RunWithShutdownFns(ns.issueQueue.Run) | |||
} | } | |||
func (ns *notificationService) NotifyCreateIssueComment(doer *models.User, repo *models.Repository, | 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{ | var opts = issueNotificationOpts{ | |||
IssueID: issue.ID, | IssueID: issue.ID, | |||
NotificationAuthorID: doer.ID, | NotificationAuthorID: doer.ID, | |||
} | } | |||
if comment != nil { | if comment != nil { | |||
opts.CommentID = comment.ID | opts.CommentID = comment.ID | |||
} | } | |||
_ = ns.issueQueue.Push(opts) | _ = 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 []*m odels.User) { | |||
_ = ns.issueQueue.Push(issueNotificationOpts{ | _ = ns.issueQueue.Push(issueNotificationOpts{ | |||
IssueID: issue.ID, | IssueID: issue.ID, | |||
NotificationAuthorID: issue.Poster.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) { | func (ns *notificationService) NotifyIssueChangeStatus(doer *models.User, issue *models.Issue, actionComment *models.Comment, isClosed bool) { | |||
_ = ns.issueQueue.Push(issueNotificationOpts{ | _ = ns.issueQueue.Push(issueNotificationOpts{ | |||
IssueID: issue.ID, | IssueID: issue.ID, | |||
NotificationAuthorID: doer.ID, | NotificationAuthorID: doer.ID, | |||
}) | }) | |||
} | } | |||
func (ns *notificationService) NotifyMergePullRequest(pr *models.PullRequest, do er *models.User) { | func (ns *notificationService) NotifyMergePullRequest(pr *models.PullRequest, do er *models.User) { | |||
_ = ns.issueQueue.Push(issueNotificationOpts{ | _ = ns.issueQueue.Push(issueNotificationOpts{ | |||
IssueID: pr.Issue.ID, | IssueID: pr.Issue.ID, | |||
NotificationAuthorID: doer.ID, | NotificationAuthorID: doer.ID, | |||
}) | }) | |||
} | } | |||
func (ns *notificationService) NotifyNewPullRequest(pr *models.PullRequest) { | func (ns *notificationService) NotifyNewPullRequest(pr *models.PullRequest, ment ions []*models.User) { | |||
if err := pr.LoadIssue(); err != nil { | if err := pr.LoadIssue(); err != nil { | |||
log.Error("Unable to load issue: %d for pr: %d: Error: %v", pr.Is sueID, pr.ID, err) | log.Error("Unable to load issue: %d for pr: %d: Error: %v", pr.Is sueID, pr.ID, err) | |||
return | return | |||
} | } | |||
_ = ns.issueQueue.Push(issueNotificationOpts{ | _ = ns.issueQueue.Push(issueNotificationOpts{ | |||
IssueID: pr.Issue.ID, | IssueID: pr.Issue.ID, | |||
NotificationAuthorID: pr.Issue.PosterID, | 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{ | var opts = issueNotificationOpts{ | |||
IssueID: pr.Issue.ID, | IssueID: pr.Issue.ID, | |||
NotificationAuthorID: r.Reviewer.ID, | NotificationAuthorID: r.Reviewer.ID, | |||
} | } | |||
if c != nil { | if c != nil { | |||
opts.CommentID = c.ID | opts.CommentID = c.ID | |||
} | } | |||
_ = ns.issueQueue.Push(opts) | _ = 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.PullReque | ||||
st, 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, p r *models.PullRequest, comment *models.Comment) { | func (ns *notificationService) NotifyPullRequestPushCommits(doer *models.User, p r *models.PullRequest, comment *models.Comment) { | |||
var opts = issueNotificationOpts{ | var opts = issueNotificationOpts{ | |||
IssueID: pr.IssueID, | IssueID: pr.IssueID, | |||
NotificationAuthorID: doer.ID, | NotificationAuthorID: doer.ID, | |||
CommentID: comment.ID, | CommentID: comment.ID, | |||
} | } | |||
_ = ns.issueQueue.Push(opts) | _ = ns.issueQueue.Push(opts) | |||
} | } | |||
End of changes. 8 change blocks. | ||||
4 lines changed or deleted | 52 lines changed or added |