Skip to content

Commit b988b86

Browse files
committed
Copy group chairs on confirmation email when a new group document revision is submitted that changes the author set. Fixes ietf-tools#1998. Commit ready for merge.
- Legacy-Id: 11877
2 parents c97424c + 2009afe commit b988b86

8 files changed

Lines changed: 124 additions & 20 deletions

File tree

ietf/doc/views_charter.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
from ietf.utils.mail import send_mail_preformatted
3333
from ietf.utils.textupload import get_cleaned_text_file_content
3434
from ietf.group.mails import email_admin_re_charter
35+
from ietf.group.views import fill_in_charter_info
3536

3637
class ChangeStateForm(forms.Form):
3738
charter_state = forms.ModelChoiceField(State.objects.filter(used=True, type="charter"), label="Charter state", empty_label=None, required=False)
@@ -446,6 +447,7 @@ def submit(request, name, option=None):
446447
except IOError:
447448
pass
448449
form = UploadForm(initial=init)
450+
fill_in_charter_info(group)
449451
return render(request, 'doc/charter/submit.html', {
450452
'form': form,
451453
'next_rev': next_rev,

ietf/mailtrigger/models.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,15 +190,20 @@ def gather_submission_group_chairs(self, **kwargs):
190190

191191
def gather_submission_confirmers(self, **kwargs):
192192
"""If a submitted document is revising an existing document, the confirmers
193-
are the authors of that existing document. Otherwise, the confirmers
193+
are the authors of that existing document, and the chairs if the document is
194+
a working group document and the author list has changed. Otherwise, the confirmers
194195
are the authors and submitter of the submitted document."""
195196

196197
addrs=[]
197198
if 'submission' in kwargs:
198199
submission = kwargs['submission']
199200
doc=submission.existing_document()
200201
if doc:
201-
addrs.extend([i.author.formatted_email() for i in doc.documentauthor_set.all() if not i.author.invalid_address()])
202+
old_authors = [i.author.formatted_email() for i in doc.documentauthor_set.all() if not i.author.invalid_address()]
203+
new_authors = [u'"%s" <%s>' % (author["name"], author["email"]) for author in submission.authors_parsed() if author["email"]]
204+
addrs.extend(old_authors)
205+
if doc.group and set(old_authors)!=set(new_authors):
206+
addrs.extend(Recipient.objects.get(slug='group_chairs').gather(**{'group':doc.group}))
202207
else:
203208
addrs.extend([u"%s <%s>" % (author["name"], author["email"]) for author in submission.authors_parsed() if author["email"]])
204209
if submission.submitter_parsed()["email"]:

ietf/submit/mail.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from ietf.utils.accesstoken import generate_access_token
1111
from ietf.mailtrigger.utils import gather_address_lists
1212

13-
def send_submission_confirmation(request, submission):
13+
def send_submission_confirmation(request, submission, chair_notice=False):
1414
subject = 'Confirm submission of I-D %s' % submission.name
1515
from_email = settings.IDSUBMIT_FROM_EMAIL
1616
(to_email, cc) = gather_address_lists('sub_confirmation_requested',submission=submission)
@@ -23,6 +23,7 @@ def send_submission_confirmation(request, submission):
2323
'submission': submission,
2424
'confirm_url': confirm_url,
2525
'status_url': status_url,
26+
'chair_notice': chair_notice,
2627
},
2728
cc=cc)
2829

ietf/submit/tests.py

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from ietf.utils.test_utils import TestCase
1616
from ietf.meeting.models import Meeting
1717
from ietf.submit.utils import expirable_submissions, expire_submission, ensure_person_email_info_exists
18-
from ietf.person.models import Person
18+
from ietf.person.models import Person, Email
1919
from ietf.group.models import Group
2020
from ietf.doc.models import Document, DocAlias, DocEvent, State, BallotDocEvent, BallotPositionDocEvent, DocumentAuthor
2121
from ietf.submit.models import Submission, Preapproval
@@ -263,14 +263,19 @@ def text_submit_new_wg_xml(self):
263263
def text_submit_new_wg_txt_xml(self):
264264
self.submit_new_wg(["txt", "xml"])
265265

266-
def submit_existing(self, formats):
266+
def submit_existing(self, formats, change_authors=True):
267267
# submit new revision of existing -> supply submitter info -> prev authors confirm
268268
draft = make_test_data()
269-
prev_author = draft.documentauthor_set.all()[0]
269+
if not change_authors:
270+
draft.documentauthor_set.all().delete()
271+
ensure_person_email_info_exists('Author Name','author@example.com')
272+
draft.documentauthor_set.create(author=Email.objects.get(address='author@example.com'))
273+
else:
274+
# Make it such that one of the previous authors has an invalid email address
275+
bogus_email = ensure_person_email_info_exists('Bogus Person',None)
276+
DocumentAuthor.objects.create(document=draft,author=bogus_email,order=draft.documentauthor_set.latest('order').order+1)
270277

271-
# Make it such that one of the previous authors has an invalid email address
272-
bogus_email = ensure_person_email_info_exists('Bogus Person',None)
273-
DocumentAuthor.objects.create(document=draft,author=bogus_email,order=draft.documentauthor_set.latest('order').order+1)
278+
prev_author = draft.documentauthor_set.all()[0]
274279

275280
# pretend IANA reviewed it
276281
draft.set_state(State.objects.get(used=True, type="draft-iana-review", slug="not-ok"))
@@ -316,11 +321,18 @@ def submit_existing(self, formats):
316321
self.assertTrue("Confirm submission" in confirm_email["Subject"])
317322
self.assertTrue(name in confirm_email["Subject"])
318323
self.assertTrue(prev_author.author.address in confirm_email["To"])
319-
# submitter and new author can't confirm
320-
self.assertTrue("author@example.com" not in confirm_email["To"])
324+
if change_authors:
325+
self.assertTrue("author@example.com" not in confirm_email["To"])
321326
self.assertTrue("submitter@example.com" not in confirm_email["To"])
322327
# Verify that mail wasn't sent to know invalid addresses
323328
self.assertTrue("unknown-email-" not in confirm_email["To"])
329+
if change_authors:
330+
# Since authors changed, ensure chairs are copied (and that the message says why)
331+
self.assertTrue("chairs have been copied" in unicode(confirm_email))
332+
self.assertTrue("mars-chairs@" in confirm_email["To"].lower())
333+
else:
334+
self.assertTrue("chairs have been copied" not in unicode(confirm_email))
335+
self.assertTrue("mars-chairs@" not in confirm_email["To"].lower())
324336

325337
confirm_url = self.extract_confirm_url(confirm_email)
326338

@@ -373,6 +385,9 @@ def test_submit_existing_xml(self):
373385
def test_submit_existing_txt_xml(self):
374386
self.submit_existing(["txt", "xml"])
375387

388+
def test_submit_existing_txt_preserve_authors(self):
389+
self.submit_existing(["txt"],change_authors=False)
390+
376391
def submit_new_individual(self, formats):
377392
# submit new -> supply submitter info -> confirm
378393
draft = make_test_data()
@@ -400,6 +415,7 @@ def submit_new_individual(self, formats):
400415
# both submitter and author get email
401416
self.assertTrue("author@example.com" in confirm_email["To"])
402417
self.assertTrue("submitter@example.com" in confirm_email["To"])
418+
self.assertFalse("chairs have been copied" in unicode(confirm_email))
403419

404420
confirm_url = self.extract_confirm_url(outbox[-1])
405421

@@ -430,6 +446,8 @@ def test_submit_new_individual_txt_xml(self):
430446

431447
def test_submit_update_individual(self):
432448
draft = make_test_data()
449+
draft.group = None
450+
draft.save_with_history([DocEvent.objects.create(doc=draft, type="added_comment", by=Person.objects.get(user__username="secretary"), desc="Test")])
433451
replaces_count = draft.relateddocument_set.filter(relationship_id='replaces').count()
434452
name = draft.name
435453
rev = '%02d'%(int(draft.rev)+1)
@@ -454,6 +472,7 @@ def test_submit_update_individual(self):
454472
r = self.client.get(status_url)
455473
self.assertEqual(len(outbox), mailbox_before + 1)
456474
confirm_url = self.extract_confirm_url(outbox[-1])
475+
self.assertFalse("chairs have been copied" in unicode(outbox[-1]))
457476
mailbox_before = len(outbox)
458477
r = self.client.post(confirm_url)
459478
self.assertEqual(r.status_code, 302)

ietf/submit/views.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,13 @@ def submission_status(request, submission_id, access_token=None):
208208

209209
requires_prev_authors_approval = Document.objects.filter(name=submission.name)
210210

211+
group_authors_changed = False
212+
doc = submission.existing_document()
213+
if doc and doc.group:
214+
old_authors = [i.author.formatted_email() for i in doc.documentauthor_set.all() if not i.author.invalid_address()]
215+
new_authors = [u'"%s" <%s>' % (author["name"], author["email"]) for author in submission.authors_parsed() if author["email"]]
216+
group_authors_changed = set(old_authors)!=set(new_authors)
217+
211218
message = None
212219

213220
if submission.state_id == "cancel":
@@ -253,7 +260,7 @@ def submission_status(request, submission_id, access_token=None):
253260
submission.state = DraftSubmissionStateName.objects.get(slug="auth")
254261
submission.save()
255262

256-
sent_to = send_submission_confirmation(request, submission)
263+
sent_to = send_submission_confirmation(request, submission, chair_notice=group_authors_changed)
257264

258265
if submission.state_id == "aut-appr":
259266
desc = u"sent confirmation email to previous authors: %s" % u", ".join(sent_to)

ietf/templates/doc/charter/submit.html

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,77 @@
1010

1111
{% block content %}
1212
{% origin %}
13-
<h1>Charter submission<br><small>{{ group.acronym }} {{ group.type.name }}</small></h1>
13+
<h1>Charter submission</h1>
1414

15-
<p class="alert alert-info">The text will be submitted as <b>{{ name }}-{{ next_rev }}</b>.</p>
15+
<table class="table table-condensed">
16+
<tbody class="meta">
17+
<tr>
18+
<th>{{ group.type.name }}</th>
19+
<th>Name</th>
20+
<td>{{ group.name }}</td>
21+
</tr>
22+
23+
<tr>
24+
<td></td>
25+
<th>Acronym</th>
26+
<td>{{ group.acronym }}</td>
27+
</tr>
28+
29+
<tr>
30+
<td></td>
31+
{% if group.parent and group.parent.type_id == "area" %}
32+
<th>{{ group.parent.type.name }}</th>
33+
<td>{{ group.parent.name }} ({{ group.parent.acronym }})</td>
34+
{% else %}
35+
<th></th><td></td>
36+
{% endif %}
37+
</tr>
38+
<tr>
39+
<td></td>
40+
<th>State</th>
41+
<td>
42+
{{ group.state.name }}
43+
{% if requested_close %}
44+
<div class="label label-info">In the process of being closed</div>
45+
{% endif %}
46+
</td>
47+
</tr>
48+
</tbody>
49+
<tbody class="meta">
50+
{% for slug, label, roles in group.personnel %}
51+
<tr>
52+
{% if forloop.first %}
53+
<th>Personnel</th>
54+
{% else %}
55+
<td></td>
56+
{% endif %}
57+
<th>{{ label }}</th>
58+
<td>
59+
60+
61+
{% for r in roles %}
62+
<span class="fa fa-envelope-o"></span>
63+
<a href="mailto:{{ r.email.address }}">{{ r.person.plain_name }}</a>
64+
<br>
65+
{% endfor %}
66+
</td>
67+
</tr>
68+
{% endfor %}
69+
</tbody>
70+
71+
{% if group.list_email %}
72+
<tbody class="meta">
73+
<tr>
74+
<th>Mailing list</th>
75+
<th>Address</th><td>{{ group.list_email|urlize }}</td>
76+
</tr>
77+
<tr><td></td><th>To subscribe</th><td>{{ group.list_subscribe|urlize }}</td></tr>
78+
<tr><td></td><th>Archive</th><td>{{ group.list_archive|urlize }}</td></tr>
79+
</tbody>
80+
{% endif %}
81+
</table>
82+
83+
<p class="alert alert-info">The text will be submitted as <b>charter-ietf-{{ name }}-{{ next_rev }}</b>.</p>
1684

1785
<form enctype="multipart/form-data" method="post">
1886
{% csrf_token %}

ietf/templates/submit/confirm_submission.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ Hi,
44
The IETF datatracker draft submission service has received your draft
55
{{ submission.name }}-{{ submission.rev }}, and requires a
66
confirmation step in order to be able to complete the posting of
7-
the draft.
7+
the draft.{% if chair_notice %}
88

9+
The chairs have been copied since this is a group document whose author list has changed.
10+
{%endif%}
911
Please follow this link to the page where you can confirm the posting:
1012

1113
{{ confirm_url }}

ietf/templates/submit/tool_instructions.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ <h2>I-D submission tool instructions</h2>
1717

1818
<h3>Upload screen</h3>
1919
<p>
20-
The Upload screen is the first screen that a user will see when he or she starts the I-D submission process. A user can submit four different formats of an I-D, plain text, XML, PDF, and postscript, at the same time. Failure to submit a plain-text version will cause an error, and an error screen will be displayed.
20+
The Upload screen is the first screen that a user will see when he or she starts the I-D submission process. A user can submit four different formats of an I-D, plain text, XML, PDF, and postscript, at the same time. Failure to submit at least one of a plain-text or xml version will cause an error, and an error screen will be displayed.
2121
</p>
2222

2323
<p>
@@ -26,7 +26,7 @@ <h3>Upload screen</h3>
2626
<table class="table table-condensed table-striped">
2727
<tr>
2828
<th>.txt format</th>
29-
<td>Button to select a plain-text file of an I-D from a user's local file system. A plain-text version is mandatory and leaving the field blank will cause an error.</td>
29+
<td>Button to select a plain-text file of an I-D from a user's local file system.</td>
3030
</tr>
3131
<tr>
3232
<th>.xml format</th>
@@ -42,13 +42,13 @@ <h3>Upload screen</h3>
4242
</tr>
4343
<tr>
4444
<th>Upload</th>
45-
<td>Button to upload the document(s). The tool will begin parsing the plain-text document and validate the document. The parsed meta-data will be displayed for user confirmation along with the validation results.</td>
45+
<td>Button to upload the document(s). The tool will begin parsing the plain-text document (or creating it from the xml if only xml is provided) and validate the document. The parsed meta-data will be displayed for user confirmation along with the validation results.</td>
4646
</tr>
4747
</table>
4848

4949
<h3>Validation screen</h3>
5050
<p>
51-
After a user uploads a plain-text version, or multiple versions of an I-D, the tool will parse the plain-text version, validate the I-D, and display the validation results with option(s) for next steps. The validation includes: checking for all IPR-related notices and I-D boilerplate described in <a href="https://www.ietf.org/ietf/1id-guidelines.html">Guidelines to Authors of Internet-Drafts</a>; the required sections described in <a href="https://www.ietf.org/ID-Checklist.html">the I-D Check List</a>; the version number; and the creation date.
51+
After a user uploads the document(s), the tool will parse the plain-text version, validate the I-D, and display the validation results with option(s) for next steps. The validation includes: checking for all IPR-related notices and I-D boilerplate described in <a href="https://www.ietf.org/ietf/1id-guidelines.html">Guidelines to Authors of Internet-Drafts</a>; the required sections described in <a href="https://www.ietf.org/ID-Checklist.html">the I-D Check List</a>; the version number; and the creation date.
5252
</p>
5353

5454
<p>
@@ -83,7 +83,7 @@ <h3>Validation screen</h3>
8383
<tr>
8484
<th>Post now</th>
8585
<td>
86-
<p>Button to start the automated posting process with submitter authentication. Once clicked, an email message will be sent to the submitter whose email address was provided within the form. The submitter will need to open the email message via his or her email application, and click the link provided in the message body.</p>
86+
<p>Button to start the automated posting process with submitter authentication. Once clicked, an email message will be sent to the parties who can verify the sybmission. For a new draft (-00), that will be the authors listed in the document. For -01 and subsequent drafts, the confirmation message is sent to the authors of the <b>previous</b> version. One of the recipients of the confirmation message will need to open the email message via his or her email application, and click the link provided in the message body.</p>
8787
<p>Once a link in the email body is clicked, the document gets pushed to the IETF Web and FTP sites, a notification is sent to the authors of the document, and an I-D Action announcement will be sent out within the next 15 minutes.</p>
8888
<p>If the document requires an additional approval from a chair of a working group, i.e., for submission of a 00 version of a working group document, then a message will be sent to the chairs of the working group for the approval. Once approved, the document will be immediately announced and available via the IETF Web and FTP sites.</p>
8989
</td>

0 commit comments

Comments
 (0)