Notify the RFC Editor when an RFC Editor note is changed after a draft has been approved. Fixes #2440. Commit ready for merge.

- Legacy-Id: 15698
This commit is contained in:
Robert Sparks 2018-11-03 08:13:10 +00:00
parent 5db8831b81
commit 43374969f6
5 changed files with 84 additions and 1 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")
draft = IndividualDraftFactory(ad=ad)

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

@ -9282,6 +9282,14 @@
"template": "{{review_req.doc.group.list_email}}"
}
},
{
"model": "mailtrigger.recipient",
"pk": "review_team_ads",
"fields": {
"desc": "The ADs of the team reviewing the document",
"template": null
}
},
{
"model": "mailtrigger.recipient",
"pk": "review_team_mail_list",
@ -9483,6 +9491,18 @@
"cc": []
}
},
{
"model": "mailtrigger.mailtrigger",
"pk": "ballot_ednote_changed_late",
"fields": {
"desc": "Recipients when the RFC Editor note for a document is changed after the document has been approved",
"to": [
"iesg",
"rfc_editor"
],
"cc": []
}
},
{
"model": "mailtrigger.mailtrigger",
"pk": "ballot_issued",
@ -10305,7 +10325,8 @@
"fields": {
"desc": "Recipients when a team notifies area directors when a review with one of a certain set of results (typically results indicating problem) is submitted",
"to": [
"review_doc_ad"
"review_doc_ad",
"review_team_ads"
],
"cc": []
}

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