MCPcopy Create free account
hub / github.com/gogs/gogs / mailParticipants

Method mailParticipants

internal/database/comment.go:166–185  ·  view source on GitHub ↗

mailParticipants sends new comment emails to repository watchers and mentioned people.

(e Engine, opType ActionType, issue *Issue)

Source from the content-addressed store, hash-verified

164// mailParticipants sends new comment emails to repository watchers
165// and mentioned people.
166func (c *Comment) mailParticipants(e Engine, opType ActionType, issue *Issue) (err error) {
167 mentions := markup.FindAllMentions(c.Content)
168 if err = updateIssueMentions(e, c.IssueID, mentions); err != nil {
169 return errors.Newf("UpdateIssueMentions [%d]: %v", c.IssueID, err)
170 }
171
172 switch opType {
173 case ActionCommentIssue:
174 issue.Content = c.Content
175 case ActionCloseIssue:
176 issue.Content = fmt.Sprintf("Closed #%d", issue.Index)
177 case ActionReopenIssue:
178 issue.Content = fmt.Sprintf("Reopened #%d", issue.Index)
179 }
180 if err = mailIssueCommentToParticipants(issue, c.Poster, mentions); err != nil {
181 log.Error("mailIssueCommentToParticipants: %v", err)
182 }
183
184 return nil
185}
186
187func createComment(e *xorm.Session, opts *CreateCommentOptions) (_ *Comment, err error) {
188 comment := &Comment{

Callers 1

createCommentFunction · 0.95

Calls 4

FindAllMentionsFunction · 0.92
updateIssueMentionsFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected