checkpoint

- Legacy-Id: 10018
This commit is contained in:
Robert Sparks 2015-08-13 22:42:39 +00:00
parent f30f5c39f1
commit c39ebe4f56
6 changed files with 90 additions and 30 deletions

View file

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

View file

@ -456,35 +456,15 @@ def rebuild_reference_relations(doc,filename=None):
return ret
def collect_email_addresses(emails, doc):
for author in doc.authors.all():
if author.address not in emails:
emails[author.address] = '"%s"' % (author.person.name)
if doc.group and doc.group.acronym != 'none':
for role in doc.group.role_set.filter(name='chair'):
if role.email.address not in emails:
emails[role.email.address] = '"%s"' % (role.person.name)
if doc.group.type.slug == 'wg':
address = '%s-ads@tools.ietf.org' % doc.group.acronym
if address not in emails:
emails[address] = '"%s-ads"' % (doc.group.acronym)
elif doc.group.type.slug == 'rg':
for role in doc.group.parent.role_set.filter(name='chair'):
if role.email.address not in emails:
emails[role.email.address] = '"%s"' % (role.person.name)
if doc.shepherd and doc.shepherd.address not in emails:
emails[doc.shepherd.address] = u'"%s"' % (doc.shepherd.person.name or "")
def set_replaces_for_document(request, doc, new_replaces, by, email_subject, email_comment=""):
emails = {}
collect_email_addresses(emails, doc)
to = gather_address_list('doc_replacement_changed',doc=doc)
relationship = DocRelationshipName.objects.get(slug='replaces')
old_replaces = doc.related_that_doc("replaces")
for d in old_replaces:
if d not in new_replaces:
collect_email_addresses(emails, d.document)
to.extend(gather_address_list('doc_replacement_changed',doc=d.document))
RelatedDocument.objects.filter(source=doc, target=d, relationship=relationship).delete()
if not RelatedDocument.objects.filter(target=d, relationship=relationship):
s = 'active' if d.document.expires > datetime.datetime.now() else 'expired'
@ -492,7 +472,7 @@ def set_replaces_for_document(request, doc, new_replaces, by, email_subject, ema
for d in new_replaces:
if d not in old_replaces:
collect_email_addresses(emails, d.document)
to.extend(gather_address_list('doc_replacement_changed',doc=d.document))
RelatedDocument.objects.create(source=doc, target=d, relationship=relationship)
d.document.set_state(State.objects.get(type='draft', slug='repl'))
@ -510,10 +490,7 @@ def set_replaces_for_document(request, doc, new_replaces, by, email_subject, ema
if email_comment:
email_desc += "\n" + email_comment
to = [
u'%s <%s>' % (emails[email], email) if emails[email] else u'<%s>' % email
for email in sorted(emails)
]
to = list(set([addr for addr in to if addr]))
from ietf.doc.mails import html_to_text

View file

@ -450,7 +450,7 @@ def change_intention(request, name):
doc.save()
# TODO: Build explicit changed_intended_publication_status
email_ad(request, doc, doc.ad, login, email_desc)
email_state_changed(request, doc, email_desc,'doc_state_edited')
return HttpResponseRedirect(doc.get_absolute_url())

View file

@ -113,6 +113,10 @@ def make_recipients(apps):
desc="The group's responsible AD(s) or IRTF chair",
template=None)
rc(slug='doc_group_responsible_directors',
desc="The document's group's responsible AD(s) or IRTF chair",
template=None)
def make_mailtokens(apps):
Recipient=apps.get_model('mailtoken','Recipient')
@ -364,6 +368,30 @@ def make_mailtokens(apps):
'doc_affecteddoc_notify',
])
mt_factory(slug='doc_pulled_from_rfc_queue',
desc="Recipients when a document is taken out of the RFC's editor queue before publication",
recipient_slugs=['iana',
'rfc_editor',
])
mt_factory(slug='doc_pulled_from_rfc_queue_cc',
desc="Recipients when a document is taken out of the RFC's editor queue before publication",
recipient_slugs=['iesg-secretary',
'doc_ad',
'doc_notify',
'doc_authors',
'doc_shepherd',
'doc_group_chairs',
])
mt_factory(slug='doc_replacement_changed',
desc="Recipients when what a document replaces or is replaced by changes",
recipient_slugs=['doc_authors',
'doc_notify',
'doc_shepherd',
'doc_group_chairs',
'doc_group_responsible_directors',
])
def forward(apps, schema_editor):

View file

@ -133,3 +133,11 @@ class Recipient(models.Model):
if group.type_id=='rg':
addrs.extend(Recipient.objects.get(slug='stream_managers').gather(**{'streams':['irtf']}))
return addrs
def gather_doc_group_responsible_directors(self, **kwargs):
addrs = []
if 'doc' in kwargs:
group = kwargs['doc'].group
if group:
addrs.extend(Recipient.objects.get(slug='group_responsible_directors').gather(**{'group':group}))
return addrs

View file

@ -4407,6 +4407,14 @@
"model": "mailtoken.recipient",
"pk": "doc_group_mail_list"
},
{
"fields": {
"template": null,
"desc": "The document's group's responsible AD(s) or IRTF chair"
},
"model": "mailtoken.recipient",
"pk": "doc_group_responsible_directors"
},
{
"fields": {
"template": "{{doc.notify}}",
@ -4762,6 +4770,45 @@
"model": "mailtoken.mailtoken",
"pk": "doc_iana_state_changed"
},
{
"fields": {
"recipients": [
"iana",
"rfc_editor"
],
"desc": "Recipients when a document is taken out of the RFC's editor queue before publication"
},
"model": "mailtoken.mailtoken",
"pk": "doc_pulled_from_rfc_queue"
},
{
"fields": {
"recipients": [
"doc_ad",
"doc_authors",
"doc_group_chairs",
"doc_notify",
"doc_shepherd"
],
"desc": "Recipients when a document is taken out of the RFC's editor queue before publication"
},
"model": "mailtoken.mailtoken",
"pk": "doc_pulled_from_rfc_queue_cc"
},
{
"fields": {
"recipients": [
"doc_authors",
"doc_group_chairs",
"doc_group_responsible_directors",
"doc_notify",
"doc_shepherd"
],
"desc": "Recipients when what a document replaces or is replaced by changes"
},
"model": "mailtoken.mailtoken",
"pk": "doc_replacement_changed"
},
{
"fields": {
"recipients": [