Autogenerate approval text if it's not there rather than requiring it

to be generated (noticed by Robert Sparks)
 - Legacy-Id: 3836
This commit is contained in:
Ole Laursen 2012-01-20 14:21:24 +00:00
parent 6a2e04adb8
commit 5fa8d71303
3 changed files with 7 additions and 16 deletions

View file

@ -674,14 +674,6 @@ class BallotWriteupsTestCase(django.test.TestCase):
# inactive
create_pos(9, "yes")
# we need approval text to be able to submit
e = WriteupDocEvent()
e.doc = draft
e.by = Person.objects.get(name="Aread Irector")
e.type = "changed_ballot_approval_text"
e.text = "The document has been approved."
e.save()
mailbox_before = len(outbox)
r = self.client.post(url, dict(
@ -699,7 +691,7 @@ class BallotWriteupsTestCase(django.test.TestCase):
self.assertTrue("comment3" in str(issue_email))
self.assertTrue("discuss3" in str(issue_email))
self.assertTrue("This is a test" in str(issue_email))
self.assertTrue("The document has been approved" in str(issue_email))
self.assertTrue("The IESG has approved" in str(issue_email))
def test_edit_approval_text(self):
draft = make_test_data()

View file

@ -932,8 +932,6 @@ def ballot_writeupnotesREDESIGN(request, name):
login = request.user.get_profile()
approval = doc.latest_event(WriteupDocEvent, type="changed_ballot_approval_text")
existing = doc.latest_event(WriteupDocEvent, type="changed_ballot_writeup_text")
if not existing:
existing = generate_ballot_writeup(request, doc)
@ -952,7 +950,7 @@ def ballot_writeupnotesREDESIGN(request, name):
e.text = t
e.save()
if "issue_ballot" in request.POST and approval:
if "issue_ballot" in request.POST:
if has_role(request.user, "Area Director") and not doc.latest_event(BallotPositionDocEvent, ad=login, time__gte=started_process.time):
# sending the ballot counts as a yes
pos = BallotPositionDocEvent(doc=doc, by=login)
@ -962,6 +960,10 @@ def ballot_writeupnotesREDESIGN(request, name):
pos.desc = "[Ballot Position Update] New position, %s, has been recorded for %s" % (pos.pos.name, pos.ad.name)
pos.save()
approval = doc.latest_event(WriteupDocEvent, type="changed_ballot_approval_text")
if not approval:
approval = generate_approval_mail(request, doc)
msg = generate_issue_ballot_mail(request, doc)
send_mail_preformatted(request, msg)
@ -989,7 +991,6 @@ def ballot_writeupnotesREDESIGN(request, name):
ballot_issued=bool(doc.latest_event(type="sent_ballot_announcement")),
ballot_writeup_form=form,
need_intended_status=need_intended_status,
approval=approval,
),
context_instance=RequestContext(request))

View file

@ -23,12 +23,10 @@ form #id_ballot_writeup {
{{ ballot_writeup_form.ballot_writeup }}
{% if not approval %}<p style="font-style:italic">Ballot cannot be issued before <a href="{% url doc_ballot_approvaltext name=doc.name %}">announcement text</a> is added.</p>{% endif %}
<div class="actions">
<a href="{{ back_url }}">Back</a>
<input type="submit" name="save_ballot_writeup" value="Save Ballot Writeup" />
<input style="margin-left: 8px" type="submit" {% if not approval %}disabled="disabled"{% endif %} name="issue_ballot" value="Save and {% if ballot_issued %}Re-{% endif %}Issue Ballot" />
<input style="margin-left: 8px" type="submit" name="issue_ballot" value="Save and {% if ballot_issued %}Re-{% endif %}Issue Ballot" />
</div>
</form>