Skip to content

Commit c39ebe4

Browse files
committed
checkpoint
- Legacy-Id: 10018
1 parent f30f5c3 commit c39ebe4

6 files changed

Lines changed: 90 additions & 30 deletions

File tree

ietf/doc/mails.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ def email_stream_changed(request, doc, old_stream, new_stream, text=""):
5252

5353
def email_pulled_from_rfc_queue(request, doc, comment, prev_state, next_state):
5454
extra=extra_automation_headers(doc)
55-
extra['Cc'] = 'iesg-secretary@ietf.org'
56-
send_mail(request, ["IANA <iana@iana.org>", "RFC Editor <rfc-editor@rfc-editor.org>"], None,
55+
extra['Cc'] = gather_addresses('doc_pulled_from_rfc_queue_cc',doc=doc)
56+
send_mail(request, gather_address_list('doc_pulled_from_rfc_queue',doc=doc), None,
5757
"%s changed state from %s to %s" % (doc.name, prev_state.name, next_state.name),
5858
"doc/mail/pulled_from_rfc_queue_email.txt",
5959
dict(doc=doc,

ietf/doc/utils.py

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -456,43 +456,23 @@ def rebuild_reference_relations(doc,filename=None):
456456

457457
return ret
458458

459-
def collect_email_addresses(emails, doc):
460-
for author in doc.authors.all():
461-
if author.address not in emails:
462-
emails[author.address] = '"%s"' % (author.person.name)
463-
if doc.group and doc.group.acronym != 'none':
464-
for role in doc.group.role_set.filter(name='chair'):
465-
if role.email.address not in emails:
466-
emails[role.email.address] = '"%s"' % (role.person.name)
467-
if doc.group.type.slug == 'wg':
468-
address = '%s-ads@tools.ietf.org' % doc.group.acronym
469-
if address not in emails:
470-
emails[address] = '"%s-ads"' % (doc.group.acronym)
471-
elif doc.group.type.slug == 'rg':
472-
for role in doc.group.parent.role_set.filter(name='chair'):
473-
if role.email.address not in emails:
474-
emails[role.email.address] = '"%s"' % (role.person.name)
475-
if doc.shepherd and doc.shepherd.address not in emails:
476-
emails[doc.shepherd.address] = u'"%s"' % (doc.shepherd.person.name or "")
477-
478459
def set_replaces_for_document(request, doc, new_replaces, by, email_subject, email_comment=""):
479-
emails = {}
480-
collect_email_addresses(emails, doc)
460+
to = gather_address_list('doc_replacement_changed',doc=doc)
481461

482462
relationship = DocRelationshipName.objects.get(slug='replaces')
483463
old_replaces = doc.related_that_doc("replaces")
484464

485465
for d in old_replaces:
486466
if d not in new_replaces:
487-
collect_email_addresses(emails, d.document)
467+
to.extend(gather_address_list('doc_replacement_changed',doc=d.document))
488468
RelatedDocument.objects.filter(source=doc, target=d, relationship=relationship).delete()
489469
if not RelatedDocument.objects.filter(target=d, relationship=relationship):
490470
s = 'active' if d.document.expires > datetime.datetime.now() else 'expired'
491471
d.document.set_state(State.objects.get(type='draft', slug=s))
492472

493473
for d in new_replaces:
494474
if d not in old_replaces:
495-
collect_email_addresses(emails, d.document)
475+
to.extend(gather_address_list('doc_replacement_changed',doc=d.document))
496476
RelatedDocument.objects.create(source=doc, target=d, relationship=relationship)
497477
d.document.set_state(State.objects.get(type='draft', slug='repl'))
498478

@@ -510,10 +490,7 @@ def set_replaces_for_document(request, doc, new_replaces, by, email_subject, ema
510490
if email_comment:
511491
email_desc += "\n" + email_comment
512492

513-
to = [
514-
u'%s <%s>' % (emails[email], email) if emails[email] else u'<%s>' % email
515-
for email in sorted(emails)
516-
]
493+
to = list(set([addr for addr in to if addr]))
517494

518495
from ietf.doc.mails import html_to_text
519496

ietf/doc/views_draft.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ def change_intention(request, name):
450450
doc.save()
451451

452452
# TODO: Build explicit changed_intended_publication_status
453-
email_ad(request, doc, doc.ad, login, email_desc)
453+
email_state_changed(request, doc, email_desc,'doc_state_edited')
454454

455455
return HttpResponseRedirect(doc.get_absolute_url())
456456

ietf/mailtoken/migrations/0002_auto_20150809_1314.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ def make_recipients(apps):
113113
desc="The group's responsible AD(s) or IRTF chair",
114114
template=None)
115115

116+
rc(slug='doc_group_responsible_directors',
117+
desc="The document's group's responsible AD(s) or IRTF chair",
118+
template=None)
119+
116120
def make_mailtokens(apps):
117121

118122
Recipient=apps.get_model('mailtoken','Recipient')
@@ -364,6 +368,30 @@ def mt_factory(slug,desc,recipient_slugs):
364368
'doc_affecteddoc_notify',
365369
])
366370

371+
mt_factory(slug='doc_pulled_from_rfc_queue',
372+
desc="Recipients when a document is taken out of the RFC's editor queue before publication",
373+
recipient_slugs=['iana',
374+
'rfc_editor',
375+
])
376+
377+
mt_factory(slug='doc_pulled_from_rfc_queue_cc',
378+
desc="Recipients when a document is taken out of the RFC's editor queue before publication",
379+
recipient_slugs=['iesg-secretary',
380+
'doc_ad',
381+
'doc_notify',
382+
'doc_authors',
383+
'doc_shepherd',
384+
'doc_group_chairs',
385+
])
386+
387+
mt_factory(slug='doc_replacement_changed',
388+
desc="Recipients when what a document replaces or is replaced by changes",
389+
recipient_slugs=['doc_authors',
390+
'doc_notify',
391+
'doc_shepherd',
392+
'doc_group_chairs',
393+
'doc_group_responsible_directors',
394+
])
367395

368396
def forward(apps, schema_editor):
369397

ietf/mailtoken/models.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,11 @@ def gather_group_responsible_directors(self, **kwargs):
133133
if group.type_id=='rg':
134134
addrs.extend(Recipient.objects.get(slug='stream_managers').gather(**{'streams':['irtf']}))
135135
return addrs
136+
137+
def gather_doc_group_responsible_directors(self, **kwargs):
138+
addrs = []
139+
if 'doc' in kwargs:
140+
group = kwargs['doc'].group
141+
if group:
142+
addrs.extend(Recipient.objects.get(slug='group_responsible_directors').gather(**{'group':group}))
143+
return addrs

ietf/name/fixtures/names.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4407,6 +4407,14 @@
44074407
"model": "mailtoken.recipient",
44084408
"pk": "doc_group_mail_list"
44094409
},
4410+
{
4411+
"fields": {
4412+
"template": null,
4413+
"desc": "The document's group's responsible AD(s) or IRTF chair"
4414+
},
4415+
"model": "mailtoken.recipient",
4416+
"pk": "doc_group_responsible_directors"
4417+
},
44104418
{
44114419
"fields": {
44124420
"template": "{{doc.notify}}",
@@ -4762,6 +4770,45 @@
47624770
"model": "mailtoken.mailtoken",
47634771
"pk": "doc_iana_state_changed"
47644772
},
4773+
{
4774+
"fields": {
4775+
"recipients": [
4776+
"iana",
4777+
"rfc_editor"
4778+
],
4779+
"desc": "Recipients when a document is taken out of the RFC's editor queue before publication"
4780+
},
4781+
"model": "mailtoken.mailtoken",
4782+
"pk": "doc_pulled_from_rfc_queue"
4783+
},
4784+
{
4785+
"fields": {
4786+
"recipients": [
4787+
"doc_ad",
4788+
"doc_authors",
4789+
"doc_group_chairs",
4790+
"doc_notify",
4791+
"doc_shepherd"
4792+
],
4793+
"desc": "Recipients when a document is taken out of the RFC's editor queue before publication"
4794+
},
4795+
"model": "mailtoken.mailtoken",
4796+
"pk": "doc_pulled_from_rfc_queue_cc"
4797+
},
4798+
{
4799+
"fields": {
4800+
"recipients": [
4801+
"doc_authors",
4802+
"doc_group_chairs",
4803+
"doc_group_responsible_directors",
4804+
"doc_notify",
4805+
"doc_shepherd"
4806+
],
4807+
"desc": "Recipients when what a document replaces or is replaced by changes"
4808+
},
4809+
"model": "mailtoken.mailtoken",
4810+
"pk": "doc_replacement_changed"
4811+
},
47654812
{
47664813
"fields": {
47674814
"recipients": [

0 commit comments

Comments
 (0)