Skip to content

Commit ac3813f

Browse files
authored
fix: improve warnings on ballot issue view. Fixes ietf-tools#7490. (ietf-tools#7491)
1 parent 99b8528 commit ac3813f

3 files changed

Lines changed: 42 additions & 3 deletions

File tree

ietf/doc/tests_ballot.py

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
from ietf.utils.test_utils import TestCase, login_testing_unauthorized
3333
from ietf.utils.mail import outbox, empty_outbox, get_payload_text
3434
from ietf.utils.text import unwrap
35-
from ietf.utils.timezone import date_today
35+
from ietf.utils.timezone import date_today, datetime_today
3636

3737

3838
class EditPositionTests(TestCase):
@@ -529,13 +529,46 @@ def test_issue_ballot_warn_if_early(self):
529529
login_testing_unauthorized(self, "secretary", url)
530530

531531
# expect warning about issuing a ballot before IETF Last Call is done
532+
# No last call has yet been issued
532533
r = self.client.get(url)
533534
self.assertEqual(r.status_code, 200)
534535
q = PyQuery(r.content)
535536
self.assertEqual(len(q('textarea[name=ballot_writeup]')), 1)
536537
self.assertTrue(q('[class=text-danger]:contains("not completed IETF Last Call")'))
537538
self.assertTrue(q('[type=submit]:contains("Save")'))
538539

540+
# Last call exists but hasn't expired
541+
LastCallDocEvent.objects.create(
542+
doc=draft,
543+
expires=datetime_today()+datetime.timedelta(days=14),
544+
by=Person.objects.get(name="(System)")
545+
)
546+
r = self.client.get(url)
547+
self.assertEqual(r.status_code, 200)
548+
q = PyQuery(r.content)
549+
self.assertTrue(q('[class=text-danger]:contains("not completed IETF Last Call")'))
550+
551+
# Last call exists and has expired
552+
LastCallDocEvent.objects.filter(doc=draft).update(expires=datetime_today()-datetime.timedelta(days=2))
553+
r = self.client.get(url)
554+
self.assertEqual(r.status_code, 200)
555+
q = PyQuery(r.content)
556+
self.assertFalse(q('[class=text-danger]:contains("not completed IETF Last Call")'))
557+
558+
for state_slug in ["lc", "watching", "ad-eval"]:
559+
draft.set_state(State.objects.get(type="draft-iesg",slug=state_slug))
560+
r = self.client.get(url)
561+
self.assertEqual(r.status_code, 200)
562+
q = PyQuery(r.content)
563+
self.assertTrue(q('[class=text-danger]:contains("It would be unexpected to issue a ballot while in this state.")'))
564+
565+
draft.set_state(State.objects.get(type="draft-iesg",slug="writeupw"))
566+
r = self.client.get(url)
567+
self.assertEqual(r.status_code, 200)
568+
q = PyQuery(r.content)
569+
self.assertFalse(q('[class=text-danger]:contains("It would be unexpected to issue a ballot while in this state.")'))
570+
571+
539572
def test_edit_approval_text(self):
540573
ad = Person.objects.get(user__username="ad")
541574
draft = WgDraftFactory(ad=ad,states=[('draft','active'),('draft-iesg','iesg-eva')],intended_std_level_id='ps',group__parent=Group.objects.get(acronym='farfut'))

ietf/doc/views_ballot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,8 @@ def ballot_writeupnotes(request, name):
687687
dict(doc=doc,
688688
back_url=doc.get_absolute_url(),
689689
ballot_issued=bool(doc.latest_event(type="sent_ballot_announcement")),
690-
ballot_issue_danger=bool(prev_state.slug in ['ad-eval', 'lc']),
690+
warn_lc = not doc.docevent_set.filter(lastcalldocevent__expires__date__lt=date_today(DEADLINE_TZINFO)).exists(),
691+
warn_unexpected_state= prev_state if bool(prev_state.slug in ['watching', 'ad-eval', 'lc']) else None,
691692
ballot_writeup_form=form,
692693
need_intended_status=need_intended_status,
693694
))

ietf/templates/doc/ballot/writeupnotes.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,16 @@ <h1>
1515
{% bootstrap_form ballot_writeup_form %}
1616
<div class="form-text my-3">
1717
Technical summary, Working Group summary, document quality, personnel, IANA note. This text will be appended to all announcements and messages to the IRTF or RFC Editor.
18-
{% if ballot_issue_danger %}
18+
{% if warn_lc %}
1919
<p class="text-danger">
2020
This document has not completed IETF Last Call. Please do not issue the ballot early without good reason.
2121
</p>
2222
{% endif %}
23+
{% if warn_unexpected_state %}
24+
<p class="text-danger">
25+
This document is in an IESG state of "{{warn_unexpected_state}}". It would be unexpected to issue a ballot while in this state.
26+
</p>
27+
{% endif %}
2328
</div>
2429
<button type="submit"
2530
class="btn btn-primary"

0 commit comments

Comments
 (0)