@@ -25,6 +25,7 @@ import (
2525 "code.gitea.io/gitea/modules/markup"
2626 "code.gitea.io/gitea/modules/setting"
2727 "code.gitea.io/gitea/modules/storage"
28+ "code.gitea.io/gitea/modules/test"
2829 "code.gitea.io/gitea/services/attachment"
2930 sender_service "code.gitea.io/gitea/services/mailer/sender"
3031
@@ -149,6 +150,22 @@ func TestComposeIssueComment(t *testing.T) {
149150 assert .Contains (t , string (b ), fmt .Sprintf (`href="%s"` , issue .HTMLURL ()))
150151}
151152
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+
152169func TestComposeIssueMessage (t * testing.T ) {
153170 doer , _ , issue , _ := prepareMailerTest (t )
154171
0 commit comments