@@ -118,26 +118,41 @@ func mailIssueCommentToParticipants(e Engine, issue *Issue, doer *User, content
118
118
119
119
// MailParticipants sends new issue thread created emails to repository watchers
120
120
// and mentioned people.
121
- func (issue * Issue ) MailParticipants (opType ActionType ) (err error ) {
122
- return issue .mailParticipants (x , opType )
121
+ func (issue * Issue ) MailParticipants (doer * User , opType ActionType ) (err error ) {
122
+ return issue .mailParticipants (x , doer , opType )
123
123
}
124
124
125
- func (issue * Issue ) mailParticipants (e Engine , opType ActionType ) (err error ) {
125
+ func (issue * Issue ) mailParticipants (e Engine , doer * User , opType ActionType ) (err error ) {
126
126
mentions := markup .FindAllMentions (issue .Content )
127
+
127
128
if err = UpdateIssueMentions (e , issue .ID , mentions ); err != nil {
128
129
return fmt .Errorf ("UpdateIssueMentions [%d]: %v" , issue .ID , err )
129
130
}
130
131
131
- var content = issue .Content
132
+ if len (issue .Content ) > 0 {
133
+ if err = mailIssueCommentToParticipants (e , issue , doer , issue .Content , nil , mentions ); err != nil {
134
+ log .Error ("mailIssueCommentToParticipants: %v" , err )
135
+ }
136
+ }
137
+
132
138
switch opType {
139
+ case ActionCreateIssue , ActionCreatePullRequest :
140
+ if len (issue .Content ) == 0 {
141
+ ct := fmt .Sprintf ("Created #%d." , issue .Index )
142
+ if err = mailIssueCommentToParticipants (e , issue , doer , ct , nil , mentions ); err != nil {
143
+ log .Error ("mailIssueCommentToParticipants: %v" , err )
144
+ }
145
+ }
133
146
case ActionCloseIssue , ActionClosePullRequest :
134
- content = fmt .Sprintf ("Closed #%d" , issue .Index )
147
+ ct := fmt .Sprintf ("Closed #%d." , issue .Index )
148
+ if err = mailIssueCommentToParticipants (e , issue , doer , ct , nil , mentions ); err != nil {
149
+ log .Error ("mailIssueCommentToParticipants: %v" , err )
150
+ }
135
151
case ActionReopenIssue , ActionReopenPullRequest :
136
- content = fmt .Sprintf ("Reopened #%d" , issue .Index )
137
- }
138
-
139
- if err = mailIssueCommentToParticipants (e , issue , issue .Poster , content , nil , mentions ); err != nil {
140
- log .Error ("mailIssueCommentToParticipants: %v" , err )
152
+ ct := fmt .Sprintf ("Reopened #%d." , issue .Index )
153
+ if err = mailIssueCommentToParticipants (e , issue , doer , ct , nil , mentions ); err != nil {
154
+ log .Error ("mailIssueCommentToParticipants: %v" , err )
155
+ }
141
156
}
142
157
143
158
return nil
0 commit comments