|
|
@ -22,18 +22,18 @@ func (issue *Issue) mailSubject() string { |
|
|
|
// This function sends two list of emails:
|
|
|
|
// This function sends two list of emails:
|
|
|
|
// 1. Repository watchers and users who are participated in comments.
|
|
|
|
// 1. Repository watchers and users who are participated in comments.
|
|
|
|
// 2. Users who are not in 1. but get mentioned in current issue/comment.
|
|
|
|
// 2. Users who are not in 1. but get mentioned in current issue/comment.
|
|
|
|
func mailIssueCommentToParticipants(issue *Issue, doer *User, comment *Comment, mentions []string) error { |
|
|
|
func mailIssueCommentToParticipants(e Engine, issue *Issue, doer *User, comment *Comment, mentions []string) error { |
|
|
|
if !setting.Service.EnableNotifyMail { |
|
|
|
if !setting.Service.EnableNotifyMail { |
|
|
|
return nil |
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
watchers, err := GetWatchers(issue.RepoID) |
|
|
|
watchers, err := getWatchers(e, issue.RepoID) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return fmt.Errorf("GetWatchers [repo_id: %d]: %v", issue.RepoID, err) |
|
|
|
return fmt.Errorf("getWatchers [repo_id: %d]: %v", issue.RepoID, err) |
|
|
|
} |
|
|
|
} |
|
|
|
participants, err := GetParticipantsByIssueID(issue.ID) |
|
|
|
participants, err := getParticipantsByIssueID(e, issue.ID) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return fmt.Errorf("GetParticipantsByIssueID [issue_id: %d]: %v", issue.ID, err) |
|
|
|
return fmt.Errorf("getParticipantsByIssueID [issue_id: %d]: %v", issue.ID, err) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// In case the issue poster is not watching the repository,
|
|
|
|
// In case the issue poster is not watching the repository,
|
|
|
@ -54,7 +54,7 @@ func mailIssueCommentToParticipants(issue *Issue, doer *User, comment *Comment, |
|
|
|
continue |
|
|
|
continue |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
to, err := GetUserByID(watchers[i].UserID) |
|
|
|
to, err := getUserByID(e, watchers[i].UserID) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return fmt.Errorf("GetUserByID [%d]: %v", watchers[i].UserID, err) |
|
|
|
return fmt.Errorf("GetUserByID [%d]: %v", watchers[i].UserID, err) |
|
|
|
} |
|
|
|
} |
|
|
@ -88,7 +88,7 @@ func mailIssueCommentToParticipants(issue *Issue, doer *User, comment *Comment, |
|
|
|
|
|
|
|
|
|
|
|
tos = append(tos, mentions[i]) |
|
|
|
tos = append(tos, mentions[i]) |
|
|
|
} |
|
|
|
} |
|
|
|
SendIssueMentionMail(issue, doer, comment, GetUserEmailsByNames(tos)) |
|
|
|
SendIssueMentionMail(issue, doer, comment, getUserEmailsByNames(e, tos)) |
|
|
|
|
|
|
|
|
|
|
|
return nil |
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
@ -96,12 +96,16 @@ func mailIssueCommentToParticipants(issue *Issue, doer *User, comment *Comment, |
|
|
|
// MailParticipants sends new issue thread created emails to repository watchers
|
|
|
|
// MailParticipants sends new issue thread created emails to repository watchers
|
|
|
|
// and mentioned people.
|
|
|
|
// and mentioned people.
|
|
|
|
func (issue *Issue) MailParticipants() (err error) { |
|
|
|
func (issue *Issue) MailParticipants() (err error) { |
|
|
|
|
|
|
|
return issue.mailParticipants(x) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (issue *Issue) mailParticipants(e Engine) (err error) { |
|
|
|
mentions := markdown.FindAllMentions(issue.Content) |
|
|
|
mentions := markdown.FindAllMentions(issue.Content) |
|
|
|
if err = UpdateIssueMentions(x, issue.ID, mentions); err != nil { |
|
|
|
if err = UpdateIssueMentions(e, issue.ID, mentions); err != nil { |
|
|
|
return fmt.Errorf("UpdateIssueMentions [%d]: %v", issue.ID, err) |
|
|
|
return fmt.Errorf("UpdateIssueMentions [%d]: %v", issue.ID, err) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if err = mailIssueCommentToParticipants(issue, issue.Poster, nil, mentions); err != nil { |
|
|
|
if err = mailIssueCommentToParticipants(e, issue, issue.Poster, nil, mentions); err != nil { |
|
|
|
log.Error(4, "mailIssueCommentToParticipants: %v", err) |
|
|
|
log.Error(4, "mailIssueCommentToParticipants: %v", err) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|