Skip to content

Commit 4f01de1

Browse files
committed
Improves who to copy when sending submission confirmation mail when authors change. Commit ready for merge.
- Legacy-Id: 12014
1 parent c9339c9 commit 4f01de1

2 files changed

Lines changed: 40 additions & 6 deletions

File tree

ietf/mailtrigger/models.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def gather_submission_authors(self, **kwargs):
182182

183183
def gather_submission_group_chairs(self, **kwargs):
184184
addrs = []
185-
if 'submission' in kwargs:
185+
if 'submission' in kwargs:
186186
submission = kwargs['submission']
187187
if submission.group:
188188
addrs.extend(Recipient.objects.get(slug='group_chairs').gather(**{'group':submission.group}))
@@ -203,7 +203,14 @@ def gather_submission_confirmers(self, **kwargs):
203203
new_authors = [u'"%s" <%s>' % (author["name"], author["email"]) for author in submission.authors_parsed() if author["email"]]
204204
addrs.extend(old_authors)
205205
if doc.group and set(old_authors)!=set(new_authors):
206-
addrs.extend(Recipient.objects.get(slug='group_chairs').gather(**{'group':doc.group}))
206+
if doc.group.type_id in ['wg','rg','ag']:
207+
addrs.extend(Recipient.objects.get(slug='group_chairs').gather(**{'group':doc.group}))
208+
elif doc.group.type_id in ['area']:
209+
addrs.extend(Recipient.objects.get(slug='group_responsible_directors').gather(**{'group':doc.group}))
210+
else:
211+
pass
212+
if doc.stream_id and doc.stream_id not in ['ietf']:
213+
addrs.extend(Recipient.objects.get(slug='stream_managers').gather(**{'streams':[doc.stream_id]}))
207214
else:
208215
addrs.extend([u"%s <%s>" % (author["name"], author["email"]) for author in submission.authors_parsed() if author["email"]])
209216
if submission.submitter_parsed()["email"]:

ietf/submit/tests.py

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,15 @@ def text_submit_new_wg_xml(self):
267267
def text_submit_new_wg_txt_xml(self):
268268
self.submit_new_wg(["txt", "xml"])
269269

270-
def submit_existing(self, formats, change_authors=True):
270+
def submit_existing(self, formats, change_authors=True, group_type='wg', stream_type='ietf'):
271271
# submit new revision of existing -> supply submitter info -> prev authors confirm
272272
draft = make_test_data()
273+
if not group_type=='wg':
274+
draft.group.type_id=group_type
275+
draft.group.save()
276+
if not stream_type=='ietf':
277+
draft.stream_id=stream_type
278+
draft.save_with_history([DocEvent.objects.create(doc=draft, type="added_comment", by=Person.objects.get(user__username="secretary"), desc="Test")])
273279
if not change_authors:
274280
draft.documentauthor_set.all().delete()
275281
ensure_person_email_info_exists('Author Name','author@example.com')
@@ -333,7 +339,15 @@ def submit_existing(self, formats, change_authors=True):
333339
if change_authors:
334340
# Since authors changed, ensure chairs are copied (and that the message says why)
335341
self.assertTrue("chairs have been copied" in unicode(confirm_email))
336-
self.assertTrue("mars-chairs@" in confirm_email["To"].lower())
342+
if group_type in ['wg','rg','ag']:
343+
self.assertTrue("mars-chairs@" in confirm_email["To"].lower())
344+
elif group_type == 'area':
345+
self.assertTrue("aread@" in confirm_email["To"].lower())
346+
else:
347+
pass
348+
if stream_type not in 'ietf':
349+
if stream_type=='ise':
350+
self.assertTrue("rfc-ise@" in confirm_email["To"].lower())
337351
else:
338352
self.assertTrue("chairs have been copied" not in unicode(confirm_email))
339353
self.assertTrue("mars-chairs@" not in confirm_email["To"].lower())
@@ -366,8 +380,9 @@ def submit_existing(self, formats, change_authors=True):
366380
self.assertTrue(not os.path.exists(os.path.join(self.staging_dir, u"%s-%s.txt" % (name, rev))))
367381
self.assertTrue(os.path.exists(os.path.join(self.repository_dir, u"%s-%s.txt" % (name, rev))))
368382
self.assertEqual(draft.type_id, "draft")
369-
self.assertEqual(draft.stream_id, "ietf")
370-
self.assertEqual(draft.get_state_slug("draft-stream-%s" % draft.stream_id), "wg-doc")
383+
if stream_type == 'ietf':
384+
self.assertEqual(draft.stream_id, "ietf")
385+
self.assertEqual(draft.get_state_slug("draft-stream-%s" % draft.stream_id), "wg-doc")
371386
self.assertEqual(draft.get_state_slug("draft-iana-review"), "changed")
372387
self.assertEqual(draft.authors.count(), 1)
373388
self.assertEqual(draft.authors.all()[0].get_name(), "Author Name")
@@ -398,6 +413,18 @@ def test_submit_existing_txt_xml(self):
398413
def test_submit_existing_txt_preserve_authors(self):
399414
self.submit_existing(["txt"],change_authors=False)
400415

416+
def test_submit_existing_rg(self):
417+
self.submit_existing(["txt"],group_type='rg')
418+
419+
def test_submit_existing_ag(self):
420+
self.submit_existing(["txt"],group_type='ag')
421+
422+
def test_submit_existing_area(self):
423+
self.submit_existing(["txt"],group_type='area')
424+
425+
def test_submit_existing_ise(self):
426+
self.submit_existing(["txt"],stream_type='ise')
427+
401428
def submit_new_individual(self, formats):
402429
# submit new -> supply submitter info -> confirm
403430
draft = make_test_data()

0 commit comments

Comments
 (0)