Skip to content

Commit 65be419

Browse files
committed
Done with the first pass instrumenting all mail points. There is one spot in the ipr code that's complicated and will require some refactor before instrumenting. There are a few places to add explicit messages (templates and all) to replace the simple use of email_ad. The next pass will be to make sure every spot that sends mail is covered by a test, and that the tests look at the headers sensibly. That will be followed by a moderately heavy refactor of MailToken and the gather_address utilities. Then pages showing the expansions of a token for a given document/group. Long way to go, but this is working well, and I think it will make things much easier later.
- Legacy-Id: 10030
1 parent 5db9e0d commit 65be419

5 files changed

Lines changed: 211 additions & 31 deletions

File tree

ietf/mailtoken/migrations/0002_auto_20150809_1314.py

Lines changed: 71 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,13 @@ def make_recipients(apps):
2525
desc='The Secretariat',
2626
template='<iesg-secretary@ietf.org>')
2727

28+
rc(slug='ietf_secretariat',
29+
desc='The Secretariat',
30+
template='<ietf-secretariat-reply@ietf.org>')
31+
2832
rc(slug='doc_authors',
2933
desc="The document's authors",
30-
template='{% if doc.type_id == "draft" %}{{doc.name}}@ietf.org{% endif %}')
34+
template='{% if doc.type_id == "draft" %}<{{doc.name}}@ietf.org>{% endif %}')
3135

3236
rc(slug='doc_notify',
3337
desc="The addresses in the document's notify field",
@@ -55,11 +59,11 @@ def make_recipients(apps):
5559

5660
rc(slug='doc_shepherd',
5761
desc="The document's shepherd",
58-
template='{% if doc.shepherd %}{{doc.shepherd.address}}{% endif %}' )
62+
template='{% if doc.shepherd %}<{{doc.shepherd.address}}>{% endif %}' )
5963

6064
rc(slug='doc_ad',
6165
desc="The document's responsible Area Director",
62-
template='{% if doc.ad %}{{doc.ad.email_address}}{% endif %}' )
66+
template='{% if doc.ad %}<{{doc.ad.email_address}}>{% endif %}' )
6367

6468
rc(slug='doc_group_mail_list',
6569
desc="The list address of the document's group",
@@ -99,7 +103,7 @@ def make_recipients(apps):
99103

100104
rc(slug='group_mail_list',
101105
desc="The group's mailing list",
102-
template='{{ group.list_email }}')
106+
template='<{{ group.list_email }}>')
103107

104108
rc(slug='group_steering_group',
105109
desc="The group's steering group (IESG or IRSG)",
@@ -119,7 +123,7 @@ def make_recipients(apps):
119123

120124
rc(slug='internet_draft_requests',
121125
desc="The internet drafts ticketing system",
122-
template='internet-drafts@ietf.org')
126+
template='<internet-drafts@ietf.org>')
123127

124128
rc(slug='submission_submitter',
125129
desc="The person that submitted a draft",
@@ -159,15 +163,15 @@ def make_recipients(apps):
159163

160164
rc(slug='session_requests',
161165
desc="The session request ticketing system",
162-
template='session-request@ietf.org')
166+
template='<session-request@ietf.org>')
163167

164168
rc(slug='logged_in_person',
165169
desc="The person currently logged into the datatracker who initiated a given action",
166-
template='{% if person and person.email_address %}{{ person.email_address }}{% endif %}')
170+
template='{% if person and person.email_address %}<{{ person.email_address }}>{% endif %}')
167171

168172
rc(slug='ipr_requests',
169173
desc="The ipr disclosure handling system",
170-
template='ietf-ipr@ietf.org')
174+
template='<ietf-ipr@ietf.org>')
171175

172176
rc(slug='ipr_submitter',
173177
desc="The submitter of an IPR disclosure",
@@ -209,12 +213,28 @@ def make_recipients(apps):
209213

210214
rc(slug='liaison_statements_list',
211215
desc="The IETF liaison statement ticketing system",
212-
template='statements@ietf.org')
216+
template='<statements@ietf.org>')
213217

214218
rc(slug='liaison_manager',
215219
desc="The assigned liaison manager for an external group ",
216220
template=None)
217221

222+
rc(slug='nominator',
223+
desc="The person that submitted a nomination to nomcom",
224+
template='{{nominator}}')
225+
226+
rc(slug='nominee',
227+
desc="The person nominated for a position",
228+
template='{{nominee}}')
229+
230+
rc(slug='nomcom_chair',
231+
desc="The chair of a given nomcom",
232+
template='{{nomcom.group.get_chair.email.address}}')
233+
234+
rc(slug='commenter',
235+
desc="The person providing a comment to nomcom",
236+
template='{{commenter}}')
237+
218238
def make_mailtokens(apps):
219239

220240
Recipient=apps.get_model('mailtoken','Recipient')
@@ -743,6 +763,48 @@ def mt_factory(slug,desc,recipient_slugs):
743763
recipient_slugs=['liaison_manager',
744764
])
745765

766+
mt_factory(slug='nomination_received',
767+
desc="Recipients for a message noting a new nomination has been received",
768+
recipient_slugs=['nomcom_chair',
769+
])
770+
771+
mt_factory(slug='nomination_receipt_requested',
772+
desc="Recipients for a message confirming a nomination was made",
773+
recipient_slugs=['nominator',
774+
])
775+
776+
mt_factory(slug='nomcom_comment_receipt_requested',
777+
desc="Recipients for a message confirming a comment was made",
778+
recipient_slugs=['commenter',
779+
])
780+
781+
mt_factory(slug='nomination_created_person',
782+
desc="Recipients for a message noting that a nomination caused a "
783+
"new Person record to be created in the datatracker",
784+
recipient_slugs=['ietf_secretariat',
785+
'nomcom_chair',
786+
])
787+
mt_factory(slug='nomination_new_nominee',
788+
desc="Recipients the first time a person is nominated for a position, "
789+
"asking them to accept or decline the nomination",
790+
recipient_slugs=['nominee',
791+
])
792+
793+
mt_factory(slug='nomination_accept_reminder',
794+
desc="Recipeints of message reminding a nominee to accept or decline a nomination",
795+
recipient_slugs=['nominee',
796+
])
797+
798+
mt_factory(slug='nomcom_questionnaire',
799+
desc="Recipients for the questionairre that nominees should complete",
800+
recipient_slugs=['nominee',
801+
])
802+
803+
mt_factory(slug='nomcom_questionnaire_reminder',
804+
desc="Recipients for a message reminding a nominee to return a completed questionairre response",
805+
recipient_slugs=['nominee',
806+
])
807+
746808
def forward(apps, schema_editor):
747809

748810
make_recipients(apps)

ietf/name/fixtures/names.json

Lines changed: 130 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4327,6 +4327,14 @@
43274327
"model": "doc.ballottype",
43284328
"pk": 3
43294329
},
4330+
{
4331+
"fields": {
4332+
"template": "{{commenter}}",
4333+
"desc": "The person providing a comment to nomcom"
4334+
},
4335+
"model": "mailtoken.recipient",
4336+
"pk": "commenter"
4337+
},
43304338
{
43314339
"fields": {
43324340
"template": null,
@@ -4345,7 +4353,7 @@
43454353
},
43464354
{
43474355
"fields": {
4348-
"template": "{% if doc.ad %}{{doc.ad.email_address}}{% endif %}",
4356+
"template": "{% if doc.ad %}<{{doc.ad.email_address}}>{% endif %}",
43494357
"desc": "The document's responsible Area Director"
43504358
},
43514359
"model": "mailtoken.recipient",
@@ -4377,7 +4385,7 @@
43774385
},
43784386
{
43794387
"fields": {
4380-
"template": "{% if doc.type_id == \"draft\" %}{{doc.name}}@ietf.org{% endif %}",
4388+
"template": "{% if doc.type_id == \"draft\" %}<{{doc.name}}@ietf.org>{% endif %}",
43814389
"desc": "The document's authors"
43824390
},
43834391
"model": "mailtoken.recipient",
@@ -4449,7 +4457,7 @@
44494457
},
44504458
{
44514459
"fields": {
4452-
"template": "{% if doc.shepherd %}{{doc.shepherd.address}}{% endif %}",
4460+
"template": "{% if doc.shepherd %}<{{doc.shepherd.address}}>{% endif %}",
44534461
"desc": "The document's shepherd"
44544462
},
44554463
"model": "mailtoken.recipient",
@@ -4481,7 +4489,7 @@
44814489
},
44824490
{
44834491
"fields": {
4484-
"template": "{{ group.list_email }}",
4492+
"template": "<{{ group.list_email }}>",
44854493
"desc": "The group's mailing list"
44864494
},
44874495
"model": "mailtoken.recipient",
@@ -4561,7 +4569,15 @@
45614569
},
45624570
{
45634571
"fields": {
4564-
"template": "internet-drafts@ietf.org",
4572+
"template": "<ietf-secretariat-reply@ietf.org>",
4573+
"desc": "The Secretariat"
4574+
},
4575+
"model": "mailtoken.recipient",
4576+
"pk": "ietf_secretariat"
4577+
},
4578+
{
4579+
"fields": {
4580+
"template": "<internet-drafts@ietf.org>",
45654581
"desc": "The internet drafts ticketing system"
45664582
},
45674583
"model": "mailtoken.recipient",
@@ -4577,7 +4593,7 @@
45774593
},
45784594
{
45794595
"fields": {
4580-
"template": "ietf-ipr@ietf.org",
4596+
"template": "<ietf-ipr@ietf.org>",
45814597
"desc": "The ipr disclosure handling system"
45824598
},
45834599
"model": "mailtoken.recipient",
@@ -4633,7 +4649,7 @@
46334649
},
46344650
{
46354651
"fields": {
4636-
"template": "statements@ietf.org",
4652+
"template": "<statements@ietf.org>",
46374653
"desc": "The IETF liaison statement ticketing system"
46384654
},
46394655
"model": "mailtoken.recipient",
@@ -4657,12 +4673,36 @@
46574673
},
46584674
{
46594675
"fields": {
4660-
"template": "{% if person and person.email_address %}{{ person.email_address }}{% endif %}",
4676+
"template": "{% if person and person.email_address %}<{{ person.email_address }}>{% endif %}",
46614677
"desc": "The person currently logged into the datatracker who initiated a given action"
46624678
},
46634679
"model": "mailtoken.recipient",
46644680
"pk": "logged_in_person"
46654681
},
4682+
{
4683+
"fields": {
4684+
"template": "{{nomcom.group.get_chair.email.address}}",
4685+
"desc": "The chair of a given nomcom"
4686+
},
4687+
"model": "mailtoken.recipient",
4688+
"pk": "nomcom_chair"
4689+
},
4690+
{
4691+
"fields": {
4692+
"template": "{{nominator}}",
4693+
"desc": "The person that submitted a nomination to nomcom"
4694+
},
4695+
"model": "mailtoken.recipient",
4696+
"pk": "nominator"
4697+
},
4698+
{
4699+
"fields": {
4700+
"template": "{{nominee}}",
4701+
"desc": "The person nominated for a position"
4702+
},
4703+
"model": "mailtoken.recipient",
4704+
"pk": "nominee"
4705+
},
46664706
{
46674707
"fields": {
46684708
"template": "<rfc-editor@rfc-editor.org>",
@@ -4681,7 +4721,7 @@
46814721
},
46824722
{
46834723
"fields": {
4684-
"template": "session-request@ietf.org",
4724+
"template": "<session-request@ietf.org>",
46854725
"desc": "The session request ticketing system"
46864726
},
46874727
"model": "mailtoken.recipient",
@@ -5415,6 +5455,87 @@
54155455
"model": "mailtoken.mailtoken",
54165456
"pk": "milestone_review_reminder_cc"
54175457
},
5458+
{
5459+
"fields": {
5460+
"recipients": [
5461+
"commenter"
5462+
],
5463+
"desc": "Recipients for a message confirming a comment was made"
5464+
},
5465+
"model": "mailtoken.mailtoken",
5466+
"pk": "nomcom_comment_receipt_requested"
5467+
},
5468+
{
5469+
"fields": {
5470+
"recipients": [
5471+
"nominee"
5472+
],
5473+
"desc": "Recipients for the questionairre that nominees should complete"
5474+
},
5475+
"model": "mailtoken.mailtoken",
5476+
"pk": "nomcom_questionnaire"
5477+
},
5478+
{
5479+
"fields": {
5480+
"recipients": [
5481+
"nominee"
5482+
],
5483+
"desc": "Recipients for a message reminding a nominee to return a completed questionairre response"
5484+
},
5485+
"model": "mailtoken.mailtoken",
5486+
"pk": "nomcom_questionnaire_reminder"
5487+
},
5488+
{
5489+
"fields": {
5490+
"recipients": [
5491+
"nominee"
5492+
],
5493+
"desc": "Recipeints of message reminding a nominee to accept or decline a nomination"
5494+
},
5495+
"model": "mailtoken.mailtoken",
5496+
"pk": "nomination_accept_reminder"
5497+
},
5498+
{
5499+
"fields": {
5500+
"recipients": [
5501+
"ietf_secretariat",
5502+
"nomcom_chair"
5503+
],
5504+
"desc": "Recipients for a message noting that a nomination caused a new Person record to be created in the datatracker"
5505+
},
5506+
"model": "mailtoken.mailtoken",
5507+
"pk": "nomination_created_person"
5508+
},
5509+
{
5510+
"fields": {
5511+
"recipients": [
5512+
"nominee"
5513+
],
5514+
"desc": "Recipients the first time a person is nominated for a position, asking them to accept or decline the nomination"
5515+
},
5516+
"model": "mailtoken.mailtoken",
5517+
"pk": "nomination_new_nominee"
5518+
},
5519+
{
5520+
"fields": {
5521+
"recipients": [
5522+
"nominator"
5523+
],
5524+
"desc": "Recipients for a message confirming a nomination was made"
5525+
},
5526+
"model": "mailtoken.mailtoken",
5527+
"pk": "nomination_receipt_requested"
5528+
},
5529+
{
5530+
"fields": {
5531+
"recipients": [
5532+
"nomcom_chair"
5533+
],
5534+
"desc": "Recipients for a message noting a new nomination has been received"
5535+
},
5536+
"model": "mailtoken.mailtoken",
5537+
"pk": "nomination_received"
5538+
},
54185539
{
54195540
"fields": {
54205541
"recipients": [

ietf/nomcom/forms.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from ietf.person.fields import SearchableEmailField
2121
from ietf.utils.fields import MultiEmailField
2222
from ietf.utils.mail import send_mail
23+
from ietf.mailtoken.utils import gather_address_list
2324

2425

2526
ROLODEX_URL = getattr(settings, 'ROLODEX_URL', None)
@@ -407,7 +408,7 @@ def save(self, commit=True):
407408
if author:
408409
subject = 'Nomination receipt'
409410
from_email = settings.NOMCOM_FROM_EMAIL
410-
to_email = author.address
411+
to_email = gather_address_list('nomination_receipt_requested',nominator=author.address)
411412
context = {'nominee': nominee.email.person.name,
412413
'comments': comments,
413414
'position': position.name}
@@ -525,7 +526,7 @@ def save(self, commit=True):
525526
if author:
526527
subject = "NomCom comment confirmation"
527528
from_email = settings.NOMCOM_FROM_EMAIL
528-
to_email = author.address
529+
to_email = gather_address_list('nomcom_comment_receipt_requested',commenter=author.address)
529530
context = {'nominee': self.nominee.email.person.name,
530531
'comments': comments,
531532
'position': self.position.name}

0 commit comments

Comments
 (0)