Added stream change and state change emails in adopt_draft() -- otherwise we wouldn't have the state change emails assumed in the previous commit. See issue #1246.

- Legacy-Id: 7207
This commit is contained in:
Henrik Levkowetz 2014-02-04 23:27:40 +00:00
parent 41c1c1a5fe
commit 62e7b515a8
2 changed files with 8 additions and 2 deletions

View file

@ -1010,7 +1010,7 @@ class AdoptDraftTests(TestCase):
self.assertEqual(draft.stream_id, "ietf")
self.assertEqual(draft.docevent_set.count() - events_before, 4)
self.assertEqual(len(outbox), mailbox_before + 1)
self.assertTrue("adopted" in outbox[-1]["Subject"].lower())
self.assertTrue("state changed" in outbox[-1]["Subject"].lower())
self.assertTrue("marschairman@ietf.org" in unicode(outbox[-1]))
self.assertTrue("marsdelegate@ietf.org" in unicode(outbox[-1]))

View file

@ -1302,7 +1302,10 @@ def adopt_draft(request, name):
if doc.stream:
e.desc += u" from %s" % doc.stream.name
e.save()
old_stream = doc.stream
doc.stream = new_stream
if old_stream != None:
email_stream_changed(request, doc, old_stream, new_stream)
# group
if group != doc.group:
@ -1315,6 +1318,8 @@ def adopt_draft(request, name):
doc.save()
comment = form.cleaned_data["comment"].strip()
# state
prev_state = doc.get_state("draft-stream-%s" % doc.stream_id)
new_state = State.objects.get(slug=adopt_state_slug, type="draft-stream-%s" % doc.stream_id, used=True)
@ -1328,8 +1333,9 @@ def adopt_draft(request, name):
update_reminder(doc, "stream-s", e, due_date)
email_stream_state_changed(request, doc, prev_state, new_state, by, comment)
# comment
comment = form.cleaned_data["comment"].strip()
if comment:
e = DocEvent(type="added_comment", time=doc.time, by=by, doc=doc)
e.desc = comment