@@ -57,9 +57,9 @@ func TestComposeIssueCommentMessage(t *testing.T) {
57
57
btpl := template .Must (template .New ("issue/comment" ).Parse (bodyTpl ))
58
58
InitMailRender (stpl , btpl )
59
59
60
-
60
+ recipients := []
* models. User {{ Name : "Test" , Email : " [email protected] "}, { Name : "Test2" , Email : " [email protected] "} }
61
61
msgs , err := composeIssueCommentMessages (& mailCommentContext {Issue : issue , Doer : doer , ActionType : models .ActionCommentIssue ,
62
- Content : "test body" , Comment : comment }, "en-US" , tos , false , "issue comment" )
62
+ Content : "test body" , Comment : comment }, "en-US" , recipients , false , "issue comment" )
63
63
assert .NoError (t , err )
64
64
assert .Len (t , msgs , 2 )
65
65
gomailMsg := msgs [0 ].ToMessage ()
@@ -92,9 +92,9 @@ func TestComposeIssueMessage(t *testing.T) {
92
92
btpl := template .Must (template .New ("issue/new" ).Parse (bodyTpl ))
93
93
InitMailRender (stpl , btpl )
94
94
95
-
95
+ recipients := []
* models. User {{ Name : "Test" , Email : " [email protected] "}, { Name : "Test2" , Email : " [email protected] "} }
96
96
msgs , err := composeIssueCommentMessages (& mailCommentContext {Issue : issue , Doer : doer , ActionType : models .ActionCreateIssue ,
97
- Content : "test body" }, "en-US" , tos , false , "issue create" )
97
+ Content : "test body" }, "en-US" , recipients , false , "issue create" )
98
98
assert .NoError (t , err )
99
99
assert .Len (t , msgs , 2 )
100
100
@@ -122,7 +122,7 @@ func TestTemplateSelection(t *testing.T) {
122
122
doer := models .AssertExistsAndLoadBean (t , & models.User {ID : 2 }).(* models.User )
123
123
repo := models .AssertExistsAndLoadBean (t , & models.Repository {ID : 1 , Owner : doer }).(* models.Repository )
124
124
issue := models .AssertExistsAndLoadBean (t , & models.Issue {ID : 1 , Repo : repo , Poster : doer }).(* models.Issue )
125
- tos := []
string { " [email protected] "}
125
+ recipients := []
* models. User {{ Name : "Test" , Email : " [email protected] "} }
126
126
127
127
stpl := texttmpl .Must (texttmpl .New ("issue/default" ).Parse ("issue/default/subject" ))
128
128
texttmpl .Must (stpl .New ("issue/new" ).Parse ("issue/new/subject" ))
@@ -146,22 +146,22 @@ func TestTemplateSelection(t *testing.T) {
146
146
}
147
147
148
148
msg := testComposeIssueCommentMessage (t , & mailCommentContext {Issue : issue , Doer : doer , ActionType : models .ActionCreateIssue ,
149
- Content : "test body" }, tos , false , "TestTemplateSelection" )
149
+ Content : "test body" }, recipients , false , "TestTemplateSelection" )
150
150
expect (t , msg , "issue/new/subject" , "issue/new/body" )
151
151
152
152
comment := models .AssertExistsAndLoadBean (t , & models.Comment {ID : 2 , Issue : issue }).(* models.Comment )
153
153
msg = testComposeIssueCommentMessage (t , & mailCommentContext {Issue : issue , Doer : doer , ActionType : models .ActionCommentIssue ,
154
- Content : "test body" , Comment : comment }, tos , false , "TestTemplateSelection" )
154
+ Content : "test body" , Comment : comment }, recipients , false , "TestTemplateSelection" )
155
155
expect (t , msg , "issue/default/subject" , "issue/default/body" )
156
156
157
157
pull := models .AssertExistsAndLoadBean (t , & models.Issue {ID : 2 , Repo : repo , Poster : doer }).(* models.Issue )
158
158
comment = models .AssertExistsAndLoadBean (t , & models.Comment {ID : 4 , Issue : pull }).(* models.Comment )
159
159
msg = testComposeIssueCommentMessage (t , & mailCommentContext {Issue : pull , Doer : doer , ActionType : models .ActionCommentPull ,
160
- Content : "test body" , Comment : comment }, tos , false , "TestTemplateSelection" )
160
+ Content : "test body" , Comment : comment }, recipients , false , "TestTemplateSelection" )
161
161
expect (t , msg , "pull/comment/subject" , "pull/comment/body" )
162
162
163
163
msg = testComposeIssueCommentMessage (t , & mailCommentContext {Issue : issue , Doer : doer , ActionType : models .ActionCloseIssue ,
164
- Content : "test body" , Comment : comment }, tos , false , "TestTemplateSelection" )
164
+ Content : "test body" , Comment : comment }, recipients , false , "TestTemplateSelection" )
165
165
expect (t , msg , "Re: [user2/repo1] issue1 (#1)" , "issue/close/body" )
166
166
}
167
167
@@ -187,9 +187,9 @@ func TestTemplateServices(t *testing.T) {
187
187
btpl := template .Must (template .New ("issue/default" ).Parse (tplBody ))
188
188
InitMailRender (stpl , btpl )
189
189
190
- tos := []
string { " [email protected] "}
190
+ recipients := []
* models. User {{ Name : "Test" , Email : " [email protected] "} }
191
191
msg := testComposeIssueCommentMessage (t , & mailCommentContext {Issue : issue , Doer : doer , ActionType : actionType ,
192
- Content : "test body" , Comment : comment }, tos , fromMention , "TestTemplateServices" )
192
+ Content : "test body" , Comment : comment }, recipients , fromMention , "TestTemplateServices" )
193
193
194
194
subject := msg .ToMessage ().GetHeader ("Subject" )
195
195
msgbuf := new (bytes.Buffer )
@@ -219,8 +219,8 @@ func TestTemplateServices(t *testing.T) {
219
219
"//Re: //" )
220
220
}
221
221
222
- func testComposeIssueCommentMessage (t * testing.T , ctx * mailCommentContext , tos []string , fromMention bool , info string ) * Message {
223
- msgs , err := composeIssueCommentMessages (ctx , "en-US" , tos , fromMention , info )
222
+ func testComposeIssueCommentMessage (t * testing.T , ctx * mailCommentContext , recipients []* models. User , fromMention bool , info string ) * Message {
223
+ msgs , err := composeIssueCommentMessages (ctx , "en-US" , recipients , fromMention , info )
224
224
assert .NoError (t , err )
225
225
assert .Len (t , msgs , 1 )
226
226
return msgs [0 ]
0 commit comments