@@ -25,6 +25,7 @@ import (
25
25
"code.gitea.io/gitea/modules/markup"
26
26
"code.gitea.io/gitea/modules/setting"
27
27
"code.gitea.io/gitea/modules/storage"
28
+ "code.gitea.io/gitea/modules/test"
28
29
"code.gitea.io/gitea/services/attachment"
29
30
sender_service "code.gitea.io/gitea/services/mailer/sender"
30
31
@@ -149,6 +150,22 @@ func TestComposeIssueComment(t *testing.T) {
149
150
assert .Contains (t , string (b ), fmt .Sprintf (`href="%s"` , issue .HTMLURL ()))
150
151
}
151
152
153
+ func TestMailMentionsComment (t * testing.T ) {
154
+ doer , _ , issue , comment := prepareMailerTest (t )
155
+ comment .Poster = doer
156
+ subjectTemplates = texttmpl .Must (texttmpl .New ("issue/comment" ).Parse (subjectTpl ))
157
+ bodyTemplates = template .Must (template .New ("issue/comment" ).Parse (bodyTpl ))
158
+ mails := 0
159
+
160
+ defer test .MockVariableValue (& SendAsync , func (msgs ... * sender_service.Message ) {
161
+ mails = len (msgs )
162
+ })()
163
+
164
+ err := MailParticipantsComment (t .Context (), comment , activities_model .ActionCommentIssue , issue , []* user_model.User {})
165
+ require .NoError (t , err )
166
+ assert .Equal (t , 3 , mails )
167
+ }
168
+
152
169
func TestComposeIssueMessage (t * testing.T ) {
153
170
doer , _ , issue , _ := prepareMailerTest (t )
154
171
0 commit comments