Send extra mail to yangdoctors chairs when a draft with yang checks goes into IETF LC. Fixes #2419. Commit ready to merge.
- Legacy-Id: 18324
This commit is contained in:
commit
cb58810705
|
@ -623,3 +623,12 @@ def email_charter_internal_review(request, charter):
|
|||
cc=addrs.cc,
|
||||
extra={'Reply-To': ["irsg@irtf.org" if charter.group.type_id == 'rg' else "iesg@ietf.org", ]},
|
||||
)
|
||||
|
||||
def email_lc_to_yang_doctors(request, doc):
|
||||
addrs = gather_address_lists('last_call_of_doc_with_yang_issued')
|
||||
send_mail(request, addrs.to, settings.DEFAULT_FROM_EMAIL,
|
||||
'Attn YangDoctors: IETF LC issued for %s' % doc.name ,
|
||||
'doc/mail/lc_to_yang_doctors.txt',
|
||||
dict(doc=doc, url=settings.IDTRACKER_BASE_URL + doc.get_absolute_url() ),
|
||||
cc = addrs.cc,
|
||||
)
|
|
@ -1220,6 +1220,7 @@ class EmailAliasesTests(TestCase):
|
|||
def setUp(self):
|
||||
WgDraftFactory(name='draft-ietf-mars-test',group__acronym='mars')
|
||||
WgDraftFactory(name='draft-ietf-ames-test',group__acronym='ames')
|
||||
RoleFactory(group__type_id='review', group__acronym='yangdoctors', name_id='secr')
|
||||
self.doc_alias_file = NamedTemporaryFile(delete=False, mode='w+')
|
||||
self.doc_alias_file.write("""# Generated by hand at 2015-02-12_16:26:45
|
||||
virtual.ietf.org anything
|
||||
|
|
|
@ -16,7 +16,7 @@ from ietf.doc.models import ( Document, State, DocEvent,
|
|||
from ietf.doc.factories import DocumentFactory, IndividualDraftFactory, IndividualRfcFactory, WgDraftFactory
|
||||
from ietf.doc.utils import create_ballot_if_not_open
|
||||
from ietf.group.models import Group, Role
|
||||
from ietf.group.factories import GroupFactory, RoleFactory
|
||||
from ietf.group.factories import GroupFactory, RoleFactory, ReviewTeamFactory
|
||||
from ietf.ipr.factories import HolderIprDisclosureFactory
|
||||
from ietf.name.models import BallotPositionName
|
||||
from ietf.iesg.models import TelechatDate
|
||||
|
@ -804,6 +804,42 @@ class MakeLastCallTests(TestCase):
|
|||
|
||||
self.assertTrue("Last Call" in draft.message_set.order_by("-time")[0].subject)
|
||||
|
||||
def test_make_last_call_yang_document(self):
|
||||
yd = ReviewTeamFactory(acronym='yangdoctors')
|
||||
secr_email = RoleFactory(group=yd,name_id='secr').person.email().address
|
||||
draft = WgDraftFactory()
|
||||
submission = draft.submission_set.create(
|
||||
state_id = 'posted',
|
||||
name = draft.name,
|
||||
group = draft.group,
|
||||
rev = draft.rev,
|
||||
authors = '[]',
|
||||
)
|
||||
submission.checks.create(
|
||||
checker = 'yang validation',
|
||||
passed = True,
|
||||
)
|
||||
|
||||
|
||||
url = urlreverse('ietf.doc.views_ballot.make_last_call', kwargs=dict(name=draft.name))
|
||||
login_testing_unauthorized(self, 'secretary', url)
|
||||
|
||||
mailbox_before = len(outbox)
|
||||
|
||||
last_call_sent_date = datetime.date.today()
|
||||
expire_date = last_call_sent_date+datetime.timedelta(days=14)
|
||||
|
||||
r = self.client.post(url,
|
||||
dict(last_call_sent_date=last_call_sent_date,
|
||||
last_call_expiration_date=expire_date
|
||||
))
|
||||
self.assertEqual(r.status_code, 302)
|
||||
self.assertEqual(len(outbox), mailbox_before + 3)
|
||||
self.assertIn("ietf-announce@", outbox[-3]['To'])
|
||||
self.assertIn("drafts-lastcall@icann.org", outbox[-2]['To'])
|
||||
self.assertIn(secr_email, outbox[-1]['To'])
|
||||
|
||||
|
||||
class DeferUndeferTestCase(TestCase):
|
||||
def helper_test_defer(self,name):
|
||||
|
||||
|
|
|
@ -26,7 +26,8 @@ from ietf.doc.utils import ( add_state_change_event, close_ballot, close_open_ba
|
|||
from ietf.doc.mails import ( email_ballot_deferred, email_ballot_undeferred,
|
||||
extra_automation_headers, generate_last_call_announcement,
|
||||
generate_issue_ballot_mail, generate_ballot_writeup, generate_ballot_rfceditornote,
|
||||
generate_approval_mail, email_irsg_ballot_closed, email_irsg_ballot_issued )
|
||||
generate_approval_mail, email_irsg_ballot_closed, email_irsg_ballot_issued,
|
||||
email_lc_to_yang_doctors )
|
||||
from ietf.doc.lastcall import request_last_call
|
||||
from ietf.iesg.models import TelechatDate
|
||||
from ietf.ietfauth.utils import has_role, role_required, is_authorized_in_doc_stream
|
||||
|
@ -1045,6 +1046,10 @@ def make_last_call(request, name):
|
|||
|
||||
doc.save_with_history(events)
|
||||
|
||||
sub = doc.submission()
|
||||
if sub and sub.has_yang():
|
||||
email_lc_to_yang_doctors(request, doc)
|
||||
|
||||
return HttpResponseRedirect(doc.get_absolute_url())
|
||||
else:
|
||||
initial = {}
|
||||
|
|
38
ietf/mailtrigger/migrations/0017_lc_to_yang_doctors.py
Normal file
38
ietf/mailtrigger/migrations/0017_lc_to_yang_doctors.py
Normal file
|
@ -0,0 +1,38 @@
|
|||
# Copyright The IETF Trust 2019-2020, All Rights Reserved
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
def forward(apps, schema_editor):
|
||||
MailTrigger = apps.get_model('mailtrigger', 'MailTrigger')
|
||||
Recipient = apps.get_model('mailtrigger', 'Recipient')
|
||||
|
||||
Recipient.objects.create(
|
||||
slug = 'yang_doctors_secretaries',
|
||||
desc = 'Yang Doctors Secretaries',
|
||||
template = ''
|
||||
)
|
||||
|
||||
lc_to_yang_doctors = MailTrigger.objects.create(
|
||||
slug='last_call_of_doc_with_yang_issued',
|
||||
desc='Recipients when IETF LC is issued on a document with yang checks',
|
||||
)
|
||||
|
||||
lc_to_yang_doctors.to.set(Recipient.objects.filter(slug='yang_doctors_secretaries'))
|
||||
|
||||
def reverse(apps, schema_editor):
|
||||
MailTrigger = apps.get_model('mailtrigger', 'MailTrigger')
|
||||
Recipient = apps.get_model('mailtrigger', 'Recipient')
|
||||
|
||||
MailTrigger.objects.filter(slug='last_call_of_doc_with_yang_issued').delete()
|
||||
Recipient.objects.filter(slug='yang_doctors_secretaries').delete()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('mailtrigger', '0016_add_irsg_ballot_issued'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(forward, reverse),
|
||||
]
|
|
@ -7,6 +7,7 @@ from django.template import Template, Context
|
|||
|
||||
from email.utils import parseaddr
|
||||
from ietf.utils.mail import formataddr, get_email_addresses_from_text
|
||||
from ietf.group.models import Group
|
||||
from ietf.person.models import Email, Alias
|
||||
from ietf.review.models import ReviewTeamSettings
|
||||
|
||||
|
@ -367,3 +368,6 @@ class Recipient(models.Model):
|
|||
for role in review_req.team.parent.role_set.filter(name='ad'):
|
||||
addrs.append(role.email.address)
|
||||
return addrs
|
||||
|
||||
def gather_yang_doctors_secretaries(self, **kwargs):
|
||||
return self.gather_group_secretaries(group=Group.objects.get(acronym='yangdoctors'))
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -73,6 +73,9 @@ class Submission(models.Model):
|
|||
def latest_checks(self):
|
||||
checks = [ self.checks.filter(checker=c).latest('time') for c in self.checks.values_list('checker', flat=True).distinct() ]
|
||||
return checks
|
||||
|
||||
def has_yang(self):
|
||||
return any ( [ c.checker=='yang validation' and c.passed is not None for c in self.latest_checks()] )
|
||||
|
||||
class SubmissionCheck(models.Model):
|
||||
time = models.DateTimeField(default=datetime.datetime.now)
|
||||
|
|
4
ietf/templates/doc/mail/lc_to_yang_doctors.txt
Normal file
4
ietf/templates/doc/mail/lc_to_yang_doctors.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
{% load ietf_filters %}{% autoescape off %}{% filter wordwrap:78 %}
|
||||
IETF Last Call has been issued for a document with yang checks.
|
||||
|
||||
The document is available at {{ url }}{% endfilter %}{% endautoescape %}
|
Loading…
Reference in a new issue