Merged in [18723] from mrcullen42@gmail.com:

Fixes #3032: Only send expiration warnings for drafts with a 'draft' state of 'active', to match the drafts that we will actually expire.
 - Legacy-Id: 18755
Note: SVN reference [18723] has been migrated to Git commit dbeb0e8d2d
This commit is contained in:
Robert Sparks 2020-12-11 20:17:55 +00:00
commit ba29ab845a
2 changed files with 18 additions and 3 deletions

View file

@ -90,8 +90,10 @@ def in_draft_expire_freeze(when=None):
return second_cut_off <= when < ietf_monday
def send_expire_warning_for_draft(doc):
if doc.get_state_slug("draft-iesg") == "dead":
return # don't warn about dead documents
if ((doc.get_state_slug("draft-iesg") == "dead") or
(doc.get_state_slug("draft") != "active")):
return # don't warn about dead or inactive documents
expiration = doc.expires.date()

View file

@ -652,7 +652,20 @@ class ExpireIDsTests(DraftFileMixin, TestCase):
self.assertTrue('draft-ietf-mars-test@' in outbox[-1]['To']) # Gets the authors
self.assertTrue('mars-chairs@ietf.org' in outbox[-1]['Cc'])
self.assertTrue('aread@' in outbox[-1]['Cc'])
#Check that we don't sent expiration warnings for dead or replaced drafts
old_state = draft.get_state_slug("draft-iesg")
mailbox_before = len(outbox)
draft.set_state(State.objects.get(type_id="draft-iesg",slug="dead"))
send_expire_warning_for_draft(draft)
self.assertEqual(len(outbox), mailbox_before,"Sent expiration warning for dead draft")
draft.set_state(State.objects.get(type_id="draft-iesg",slug=old_state))
mailbox_before = len(outbox)
draft.set_state(State.objects.get(type_id="draft",slug="repl"))
send_expire_warning_for_draft(draft)
self.assertEqual(len(outbox), mailbox_before,"Sent expiration warning for replaced draft")
def test_expire_drafts(self):
mars = GroupFactory(type_id='wg',acronym='mars')
ad_role = RoleFactory(group=mars, name_id='ad', person=Person.objects.get(user__username='ad'))