Add a checkbox to cc the group list address on ballot positions if a document belongs to a group. Add better tests of the checkboxes on that form. Commit ready for merge.

- Legacy-Id: 9505
This commit is contained in:
Robert Sparks 2015-04-15 14:53:42 +00:00
parent b91c65e336
commit b84d4d3a20
3 changed files with 23 additions and 1 deletions

View file

@ -152,7 +152,7 @@ class EditPositionTests(TestCase):
# send
mailbox_before = len(outbox)
r = self.client.post(url, dict(cc="test@example.com", cc_state_change="1"))
r = self.client.post(url, dict(cc="test@example.com", cc_state_change="1",cc_group_list="1"))
self.assertEqual(r.status_code, 302)
self.assertEqual(len(outbox), mailbox_before + 1)
@ -162,6 +162,17 @@ class EditPositionTests(TestCase):
self.assertTrue(draft.name in m['Subject'])
self.assertTrue("clearer title" in str(m))
self.assertTrue("Test!" in str(m))
self.assertTrue("somebody@example.com" in m['Cc'])
self.assertTrue("test@example.com" in m['Cc'])
self.assertTrue(draft.group.list_email) # temporary - remove before commit
self.assertTrue(draft.group.list_email in m['Cc'])
r = self.client.post(url, dict(cc=""))
self.assertEqual(r.status_code, 302)
self.assertEqual(len(outbox), mailbox_before + 2)
m = outbox[-1]
self.assertEqual(m['Cc'],None)
class BallotWriteupsTests(TestCase):
def test_edit_last_call_text(self):

View file

@ -290,6 +290,8 @@ def send_ballot_comment(request, name, ballot_id):
cc = [x.strip() for x in request.POST.get("cc", "").split(',') if x.strip()]
if request.POST.get("cc_state_change") and doc.notify:
cc.extend(doc.notify.split(','))
if request.POST.get("cc_group_list") and doc.group.list_email:
cc.append(doc.group.list_email)
send_mail_text(request, to, frm, subject, body, cc=u", ".join(cc))

View file

@ -37,6 +37,15 @@
</div>
{% endif %}
{% if doc.group.list_email %}
<div class="checkbox">
<label>
<input type="checkbox" name="cc_group_list" value="1" checked>
<b>Cc:</b> {{ doc.group.list_email }}
</label>
</div>
{% endif %}
<div class="form-group">
<label>Subject</label>
<input class="form-control" type="text" placeholder="{{ subject }}" disabled>