@@ -22,18 +22,18 @@ func (issue *Issue) mailSubject() string {
22
22
// This function sends two list of emails:
23
23
// 1. Repository watchers and users who are participated in comments.
24
24
// 2. Users who are not in 1. but get mentioned in current issue/comment.
25
- func mailIssueCommentToParticipants (issue * Issue , doer * User , comment * Comment , mentions []string ) error {
25
+ func mailIssueCommentToParticipants (e Engine , issue * Issue , doer * User , comment * Comment , mentions []string ) error {
26
26
if ! setting .Service .EnableNotifyMail {
27
27
return nil
28
28
}
29
29
30
- watchers , err := GetWatchers ( issue .RepoID )
30
+ watchers , err := getWatchers ( e , issue .RepoID )
31
31
if err != nil {
32
- return fmt .Errorf ("GetWatchers [repo_id: %d]: %v" , issue .RepoID , err )
32
+ return fmt .Errorf ("getWatchers [repo_id: %d]: %v" , issue .RepoID , err )
33
33
}
34
- participants , err := GetParticipantsByIssueID ( issue .ID )
34
+ participants , err := getParticipantsByIssueID ( e , issue .ID )
35
35
if err != nil {
36
- return fmt .Errorf ("GetParticipantsByIssueID [issue_id: %d]: %v" , issue .ID , err )
36
+ return fmt .Errorf ("getParticipantsByIssueID [issue_id: %d]: %v" , issue .ID , err )
37
37
}
38
38
39
39
// In case the issue poster is not watching the repository,
@@ -54,7 +54,7 @@ func mailIssueCommentToParticipants(issue *Issue, doer *User, comment *Comment,
54
54
continue
55
55
}
56
56
57
- to , err := GetUserByID ( watchers [i ].UserID )
57
+ to , err := getUserByID ( e , watchers [i ].UserID )
58
58
if err != nil {
59
59
return fmt .Errorf ("GetUserByID [%d]: %v" , watchers [i ].UserID , err )
60
60
}
@@ -88,20 +88,24 @@ func mailIssueCommentToParticipants(issue *Issue, doer *User, comment *Comment,
88
88
89
89
tos = append (tos , mentions [i ])
90
90
}
91
- SendIssueMentionMail (issue , doer , comment , GetUserEmailsByNames ( tos ))
91
+ SendIssueMentionMail (issue , doer , comment , getUserEmailsByNames ( e , tos ))
92
92
93
93
return nil
94
94
}
95
95
96
96
// MailParticipants sends new issue thread created emails to repository watchers
97
97
// and mentioned people.
98
98
func (issue * Issue ) MailParticipants () (err error ) {
99
+ return issue .mailParticipants (x )
100
+ }
101
+
102
+ func (issue * Issue ) mailParticipants (e Engine ) (err error ) {
99
103
mentions := markdown .FindAllMentions (issue .Content )
100
- if err = UpdateIssueMentions (x , issue .ID , mentions ); err != nil {
104
+ if err = UpdateIssueMentions (e , issue .ID , mentions ); err != nil {
101
105
return fmt .Errorf ("UpdateIssueMentions [%d]: %v" , issue .ID , err )
102
106
}
103
107
104
- if err = mailIssueCommentToParticipants (issue , issue .Poster , nil , mentions ); err != nil {
108
+ if err = mailIssueCommentToParticipants (e , issue , issue .Poster , nil , mentions ); err != nil {
105
109
log .Error (4 , "mailIssueCommentToParticipants: %v" , err )
106
110
}
107
111
0 commit comments