Skip to content

Commit 4337496

Browse files
committed
Notify the RFC Editor when an RFC Editor note is changed after a draft has been approved. Fixes ietf-tools#2440. Commit ready for merge.
- Legacy-Id: 15698
1 parent 5db8831 commit 4337496

5 files changed

Lines changed: 84 additions & 1 deletion

File tree

ietf/doc/tests_ballot.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,13 +395,15 @@ def test_edit_ballot_rfceditornote(self):
395395
self.assertTrue("This is a note for the RFC Editor" in r.content)
396396

397397
# save with a note
398+
empty_outbox()
398399
r = self.client.post(url, dict(
399400
rfc_editor_note="This is a simple test.",
400401
save_ballot_rfceditornote="1"))
401402
self.assertEqual(r.status_code, 200)
402403
draft = Document.objects.get(name=draft.name)
403404
self.assertTrue(draft.has_rfc_editor_note())
404405
self.assertTrue("This is a simple test" in draft.latest_event(WriteupDocEvent, type="changed_rfc_editor_note_text").text)
406+
self.assertEqual(len(outbox), 0)
405407

406408
# clear the existing note
407409
r = self.client.post(url, dict(
@@ -411,6 +413,16 @@ def test_edit_ballot_rfceditornote(self):
411413
draft = Document.objects.get(name=draft.name)
412414
self.assertFalse(draft.has_rfc_editor_note())
413415

416+
# Add a note after the doc is approved
417+
empty_outbox()
418+
draft.set_state(State.objects.get(type='draft-iesg',slug='approved'))
419+
r = self.client.post(url, dict(
420+
rfc_editor_note='This is a new note.',
421+
save_ballot_rfceditornote="1"))
422+
self.assertEqual(r.status_code, 200)
423+
self.assertEqual(len(outbox),1)
424+
self.assertIn('RFC Editor note changed',outbox[-1]['Subject'])
425+
414426
def test_issue_ballot(self):
415427
ad = Person.objects.get(user__username="ad")
416428
draft = IndividualDraftFactory(ad=ad)

ietf/doc/views_ballot.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,19 @@ def ballot_rfceditornote(request, name):
683683
e.text = t.rstrip()
684684
e.save()
685685

686+
if doc.get_state_slug('draft-iesg') in ['approved', 'ann', 'rfcqueue']:
687+
(to, cc) = gather_address_lists('ballot_ednote_changed_late').as_strings()
688+
msg = render_to_string(
689+
'doc/ballot/ednote_changed_late.txt',
690+
context = dict(
691+
to = to,
692+
cc = cc,
693+
event = e,
694+
settings = settings,
695+
)
696+
)
697+
send_mail_preformatted(request, msg)
698+
686699
if request.method == 'POST' and "clear_ballot_rfceditornote" in request.POST:
687700
e = WriteupDocEvent(doc=doc, rev=doc.rev, by=login)
688701
e.by = login
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# -*- coding: utf-8 -*-
2+
# Generated by Django 1.11.16 on 2018-11-03 00:24
3+
from __future__ import unicode_literals
4+
5+
from django.db import migrations
6+
7+
def forward(apps, schema_editor):
8+
MailTrigger = apps.get_model('mailtrigger', 'MailTrigger')
9+
Recipient = apps.get_model('mailtrigger', 'Recipient')
10+
11+
changed = MailTrigger.objects.create(
12+
slug = 'ballot_ednote_changed_late',
13+
desc = 'Recipients when the RFC Editor note for a document is changed after the document has been approved',
14+
)
15+
changed.to.set(Recipient.objects.filter(slug__in=['rfc_editor','iesg']))
16+
17+
def reverse(apps, schema_editor):
18+
MailTrigger = apps.get_model('mailtrigger','MailTrigger')
19+
MailTrigger.objects.filter(slug='ballot_ednote_changed_late').delete()
20+
21+
class Migration(migrations.Migration):
22+
23+
dependencies = [
24+
('mailtrigger', '0003_add_review_notify_ad'),
25+
]
26+
27+
operations = [
28+
migrations.RunPython(forward, reverse)
29+
]

ietf/name/fixtures/names.json

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9282,6 +9282,14 @@
92829282
"template": "{{review_req.doc.group.list_email}}"
92839283
}
92849284
},
9285+
{
9286+
"model": "mailtrigger.recipient",
9287+
"pk": "review_team_ads",
9288+
"fields": {
9289+
"desc": "The ADs of the team reviewing the document",
9290+
"template": null
9291+
}
9292+
},
92859293
{
92869294
"model": "mailtrigger.recipient",
92879295
"pk": "review_team_mail_list",
@@ -9483,6 +9491,18 @@
94839491
"cc": []
94849492
}
94859493
},
9494+
{
9495+
"model": "mailtrigger.mailtrigger",
9496+
"pk": "ballot_ednote_changed_late",
9497+
"fields": {
9498+
"desc": "Recipients when the RFC Editor note for a document is changed after the document has been approved",
9499+
"to": [
9500+
"iesg",
9501+
"rfc_editor"
9502+
],
9503+
"cc": []
9504+
}
9505+
},
94869506
{
94879507
"model": "mailtrigger.mailtrigger",
94889508
"pk": "ballot_issued",
@@ -10305,7 +10325,8 @@
1030510325
"fields": {
1030610326
"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",
1030710327
"to": [
10308-
"review_doc_ad"
10328+
"review_doc_ad",
10329+
"review_team_ads"
1030910330
],
1031010331
"cc": []
1031110332
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{% load ietf_filters %}{% autoescape off %}To: {{to}}{% if cc %}
2+
Cc: {{cc}}{% endif %}
3+
Subject: RFC Editor note changed for {{event.doc}}
4+
5+
The RFC Editor note for {{event.doc}} has changed after the doc was approved.
6+
7+
The new note can be seen at {{settings.IDTRACKER_BASE_URL}}{% url 'ietf.doc.views_doc.document_writeup' name=event.doc.name %}
8+
{% endautoescape %}

0 commit comments

Comments
 (0)