diff --git a/ietf/doc/tests_ballot.py b/ietf/doc/tests_ballot.py index 8725a8d87..a002467af 100644 --- a/ietf/doc/tests_ballot.py +++ b/ietf/doc/tests_ballot.py @@ -395,6 +395,7 @@ class BallotWriteupsTests(TestCase): self.assertTrue("This is a note for the RFC Editor" in r.content) # save with a note + empty_outbox() r = self.client.post(url, dict( rfc_editor_note="This is a simple test.", save_ballot_rfceditornote="1")) @@ -402,6 +403,7 @@ class BallotWriteupsTests(TestCase): draft = Document.objects.get(name=draft.name) self.assertTrue(draft.has_rfc_editor_note()) self.assertTrue("This is a simple test" in draft.latest_event(WriteupDocEvent, type="changed_rfc_editor_note_text").text) + self.assertEqual(len(outbox), 0) # clear the existing note r = self.client.post(url, dict( @@ -411,6 +413,16 @@ class BallotWriteupsTests(TestCase): draft = Document.objects.get(name=draft.name) self.assertFalse(draft.has_rfc_editor_note()) + # Add a note after the doc is approved + empty_outbox() + draft.set_state(State.objects.get(type='draft-iesg',slug='approved')) + r = self.client.post(url, dict( + rfc_editor_note='This is a new note.', + save_ballot_rfceditornote="1")) + self.assertEqual(r.status_code, 200) + self.assertEqual(len(outbox),1) + self.assertIn('RFC Editor note changed',outbox[-1]['Subject']) + def test_issue_ballot(self): ad = Person.objects.get(user__username="ad") for case in ('none','past','future'): diff --git a/ietf/doc/views_ballot.py b/ietf/doc/views_ballot.py index dc5b1ede7..aca61804c 100644 --- a/ietf/doc/views_ballot.py +++ b/ietf/doc/views_ballot.py @@ -683,6 +683,19 @@ def ballot_rfceditornote(request, name): e.text = t.rstrip() e.save() + if doc.get_state_slug('draft-iesg') in ['approved', 'ann', 'rfcqueue']: + (to, cc) = gather_address_lists('ballot_ednote_changed_late').as_strings() + msg = render_to_string( + 'doc/ballot/ednote_changed_late.txt', + context = dict( + to = to, + cc = cc, + event = e, + settings = settings, + ) + ) + send_mail_preformatted(request, msg) + if request.method == 'POST' and "clear_ballot_rfceditornote" in request.POST: e = WriteupDocEvent(doc=doc, rev=doc.rev, by=login) e.by = login diff --git a/ietf/mailtrigger/migrations/0004_ballot_rfceditornote_changed_postapproval.py b/ietf/mailtrigger/migrations/0004_ballot_rfceditornote_changed_postapproval.py new file mode 100644 index 000000000..592afe92b --- /dev/null +++ b/ietf/mailtrigger/migrations/0004_ballot_rfceditornote_changed_postapproval.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.16 on 2018-11-03 00:24 +from __future__ import unicode_literals + +from django.db import migrations + +def forward(apps, schema_editor): + MailTrigger = apps.get_model('mailtrigger', 'MailTrigger') + Recipient = apps.get_model('mailtrigger', 'Recipient') + + changed = MailTrigger.objects.create( + slug = 'ballot_ednote_changed_late', + desc = 'Recipients when the RFC Editor note for a document is changed after the document has been approved', + ) + changed.to.set(Recipient.objects.filter(slug__in=['rfc_editor','iesg'])) + +def reverse(apps, schema_editor): + MailTrigger = apps.get_model('mailtrigger','MailTrigger') + MailTrigger.objects.filter(slug='ballot_ednote_changed_late').delete() + +class Migration(migrations.Migration): + + dependencies = [ + ('mailtrigger', '0003_add_review_notify_ad'), + ] + + operations = [ + migrations.RunPython(forward, reverse) + ] diff --git a/ietf/name/fixtures/names.json b/ietf/name/fixtures/names.json index b4f1f89f7..cfce351ee 100644 --- a/ietf/name/fixtures/names.json +++ b/ietf/name/fixtures/names.json @@ -2753,6 +2753,18 @@ "model": "mailtrigger.mailtrigger", "pk": "ballot_deferred" }, + { + "fields": { + "cc": [], + "desc": "Recipients when the RFC Editor note for a document is changed after the document has been approved", + "to": [ + "iesg", + "rfc_editor" + ] + }, + "model": "mailtrigger.mailtrigger", + "pk": "ballot_ednote_changed_late" + }, { "fields": { "cc": [], @@ -10503,7 +10515,7 @@ "fields": { "command": "xym", "switch": "--version", - "time": "2018-11-02T00:08:27.707", + "time": "2018-11-05T00:08:25.451", "used": true, "version": "xym 0.4" }, @@ -10514,7 +10526,7 @@ "fields": { "command": "pyang", "switch": "--version", - "time": "2018-11-02T00:08:28.485", + "time": "2018-11-05T00:08:26.227", "used": true, "version": "pyang 1.7.5" }, @@ -10525,7 +10537,7 @@ "fields": { "command": "yanglint", "switch": "--version", - "time": "2018-11-02T00:08:28.661", + "time": "2018-11-05T00:08:26.434", "used": true, "version": "yanglint 0.14.80" }, @@ -10536,7 +10548,7 @@ "fields": { "command": "xml2rfc", "switch": "--version", - "time": "2018-11-02T00:08:29.566", + "time": "2018-11-05T00:08:27.578", "used": true, "version": "xml2rfc 2.12.3" }, diff --git a/ietf/stats/utils.py b/ietf/stats/utils.py index fdc7dbbd0..4b70dcbb2 100644 --- a/ietf/stats/utils.py +++ b/ietf/stats/utils.py @@ -262,6 +262,7 @@ def get_meeting_registration_data(meeting): person = emails.first().person # Create a new Person object else: + try: # Normalize all-caps or all-lower entries. Don't touch # others, there might be names properly spelled with # internal uppercase letters. @@ -310,7 +311,13 @@ def get_meeting_registration_data(meeting): if Email.objects.filter(person=person).count() == 1: email.primary = True email.save() - + except: + debug.show('first_name') + debug.show('last_name') + debug.show('regname') + debug.show('user') + debug.show('aliases') + raise # update the person object to an actual value object.person = person object.save() diff --git a/ietf/templates/doc/ballot/ednote_changed_late.txt b/ietf/templates/doc/ballot/ednote_changed_late.txt new file mode 100644 index 000000000..cb0a42ed5 --- /dev/null +++ b/ietf/templates/doc/ballot/ednote_changed_late.txt @@ -0,0 +1,8 @@ +{% load ietf_filters %}{% autoescape off %}To: {{to}}{% if cc %} +Cc: {{cc}}{% endif %} +Subject: RFC Editor note changed for {{event.doc}} + +The RFC Editor note for {{event.doc}} has changed after the doc was approved. + +The new note can be seen at {{settings.IDTRACKER_BASE_URL}}{% url 'ietf.doc.views_doc.document_writeup' name=event.doc.name %} +{% endautoescape %} \ No newline at end of file