fix: improve warnings on ballot issue view. Fixes #7490. (#7491)

This commit is contained in:
Robert Sparks 2024-06-04 12:38:54 -05:00 committed by GitHub
parent 99b852805b
commit ac3813f1af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 42 additions and 3 deletions

View file

@ -32,7 +32,7 @@ from ietf.person.utils import get_active_ads
from ietf.utils.test_utils import TestCase, login_testing_unauthorized from ietf.utils.test_utils import TestCase, login_testing_unauthorized
from ietf.utils.mail import outbox, empty_outbox, get_payload_text from ietf.utils.mail import outbox, empty_outbox, get_payload_text
from ietf.utils.text import unwrap from ietf.utils.text import unwrap
from ietf.utils.timezone import date_today from ietf.utils.timezone import date_today, datetime_today
class EditPositionTests(TestCase): class EditPositionTests(TestCase):
@ -529,6 +529,7 @@ class BallotWriteupsTests(TestCase):
login_testing_unauthorized(self, "secretary", url) login_testing_unauthorized(self, "secretary", url)
# expect warning about issuing a ballot before IETF Last Call is done # expect warning about issuing a ballot before IETF Last Call is done
# No last call has yet been issued
r = self.client.get(url) r = self.client.get(url)
self.assertEqual(r.status_code, 200) self.assertEqual(r.status_code, 200)
q = PyQuery(r.content) q = PyQuery(r.content)
@ -536,6 +537,38 @@ class BallotWriteupsTests(TestCase):
self.assertTrue(q('[class=text-danger]:contains("not completed IETF Last Call")')) self.assertTrue(q('[class=text-danger]:contains("not completed IETF Last Call")'))
self.assertTrue(q('[type=submit]:contains("Save")')) self.assertTrue(q('[type=submit]:contains("Save")'))
# Last call exists but hasn't expired
LastCallDocEvent.objects.create(
doc=draft,
expires=datetime_today()+datetime.timedelta(days=14),
by=Person.objects.get(name="(System)")
)
r = self.client.get(url)
self.assertEqual(r.status_code, 200)
q = PyQuery(r.content)
self.assertTrue(q('[class=text-danger]:contains("not completed IETF Last Call")'))
# Last call exists and has expired
LastCallDocEvent.objects.filter(doc=draft).update(expires=datetime_today()-datetime.timedelta(days=2))
r = self.client.get(url)
self.assertEqual(r.status_code, 200)
q = PyQuery(r.content)
self.assertFalse(q('[class=text-danger]:contains("not completed IETF Last Call")'))
for state_slug in ["lc", "watching", "ad-eval"]:
draft.set_state(State.objects.get(type="draft-iesg",slug=state_slug))
r = self.client.get(url)
self.assertEqual(r.status_code, 200)
q = PyQuery(r.content)
self.assertTrue(q('[class=text-danger]:contains("It would be unexpected to issue a ballot while in this state.")'))
draft.set_state(State.objects.get(type="draft-iesg",slug="writeupw"))
r = self.client.get(url)
self.assertEqual(r.status_code, 200)
q = PyQuery(r.content)
self.assertFalse(q('[class=text-danger]:contains("It would be unexpected to issue a ballot while in this state.")'))
def test_edit_approval_text(self): def test_edit_approval_text(self):
ad = Person.objects.get(user__username="ad") ad = Person.objects.get(user__username="ad")
draft = WgDraftFactory(ad=ad,states=[('draft','active'),('draft-iesg','iesg-eva')],intended_std_level_id='ps',group__parent=Group.objects.get(acronym='farfut')) draft = WgDraftFactory(ad=ad,states=[('draft','active'),('draft-iesg','iesg-eva')],intended_std_level_id='ps',group__parent=Group.objects.get(acronym='farfut'))

View file

@ -687,7 +687,8 @@ def ballot_writeupnotes(request, name):
dict(doc=doc, dict(doc=doc,
back_url=doc.get_absolute_url(), back_url=doc.get_absolute_url(),
ballot_issued=bool(doc.latest_event(type="sent_ballot_announcement")), ballot_issued=bool(doc.latest_event(type="sent_ballot_announcement")),
ballot_issue_danger=bool(prev_state.slug in ['ad-eval', 'lc']), warn_lc = not doc.docevent_set.filter(lastcalldocevent__expires__date__lt=date_today(DEADLINE_TZINFO)).exists(),
warn_unexpected_state= prev_state if bool(prev_state.slug in ['watching', 'ad-eval', 'lc']) else None,
ballot_writeup_form=form, ballot_writeup_form=form,
need_intended_status=need_intended_status, need_intended_status=need_intended_status,
)) ))

View file

@ -15,11 +15,16 @@
{% bootstrap_form ballot_writeup_form %} {% bootstrap_form ballot_writeup_form %}
<div class="form-text my-3"> <div class="form-text my-3">
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. 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.
{% if ballot_issue_danger %} {% if warn_lc %}
<p class="text-danger"> <p class="text-danger">
This document has not completed IETF Last Call. Please do not issue the ballot early without good reason. This document has not completed IETF Last Call. Please do not issue the ballot early without good reason.
</p> </p>
{% endif %} {% endif %}
{% if warn_unexpected_state %}
<p class="text-danger">
This document is in an IESG state of "{{warn_unexpected_state}}". It would be unexpected to issue a ballot while in this state.
</p>
{% endif %}
</div> </div>
<button type="submit" <button type="submit"
class="btn btn-primary" class="btn btn-primary"