Merged in [15698] from rjsparks@nostrum.com:

Notify the RFC Editor when an RFC Editor note is changed after a draft has been approved. Fixes #2440.
 - Legacy-Id: 15729
Note: SVN reference [15698] has been migrated to Git commit 43374969f6
This commit is contained in:
Henrik Levkowetz 2018-11-06 07:13:56 +00:00
commit e4af908a74
6 changed files with 86 additions and 5 deletions

View file

@ -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'):

View file

@ -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

View file

@ -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)
]

View file

@ -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"
},

View file

@ -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()

View file

@ -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 %}