diff --git a/ietf/doc/mails.py b/ietf/doc/mails.py index 2f0fce9f8..e0d2d40cf 100644 --- a/ietf/doc/mails.py +++ b/ietf/doc/mails.py @@ -417,6 +417,24 @@ def email_last_call_expired(doc): url=settings.IDTRACKER_BASE_URL + doc.get_absolute_url()), cc = addrs.cc) +def email_adopted(request, doc, prev_state, new_state, by, comment=""): + (to, cc) = gather_address_lists('doc_adopted_by_group',doc=doc) + + state_type = (prev_state or new_state).type + + send_mail(request, to, settings.DEFAULT_FROM_EMAIL, + u"The %s %s has adopted %s" % + (doc.group.acronym.upper(),doc.group.type_id.upper(), doc.name), + 'doc/mail/doc_adopted_email.txt', + dict(doc=doc, + url=settings.IDTRACKER_BASE_URL + doc.get_absolute_url(), + state_type=state_type, + prev_state=prev_state, + new_state=new_state, + by=by, + comment=comment), + cc=cc) + def email_stream_state_changed(request, doc, prev_state, new_state, by, comment=""): (to, cc)= gather_address_lists('doc_stream_state_edited',doc=doc) diff --git a/ietf/doc/tests_draft.py b/ietf/doc/tests_draft.py index 3672b80ee..f4a0a4cda 100644 --- a/ietf/doc/tests_draft.py +++ b/ietf/doc/tests_draft.py @@ -1135,9 +1135,10 @@ class AdoptDraftTests(TestCase): self.assertEqual(draft.docevent_set.count() - events_before, 5) self.assertEqual(draft.notify,"aliens@example.mars") self.assertEqual(len(outbox), mailbox_before + 1) - self.assertTrue("state changed" in outbox[-1]["Subject"].lower()) - self.assertTrue("mars-chairs@ietf.org" in unicode(outbox[-1])) - self.assertTrue("marsdelegate@ietf.org" in unicode(outbox[-1])) + self.assertTrue("has adopted" in outbox[-1]["Subject"].lower()) + self.assertTrue("mars-chairs@ietf.org" in outbox[-1]['To']) + self.assertTrue("draft-ietf-mars-test@" in outbox[-1]['To']) + self.assertTrue("mars-wg@" in outbox[-1]['To']) self.assertFalse(mars.list_email in draft.notify) diff --git a/ietf/doc/views_draft.py b/ietf/doc/views_draft.py index 629b0f48b..ab9ee420f 100644 --- a/ietf/doc/views_draft.py +++ b/ietf/doc/views_draft.py @@ -19,7 +19,7 @@ from ietf.doc.models import ( Document, DocAlias, RelatedDocument, State, from ietf.doc.mails import ( email_ad, email_pulled_from_rfc_queue, email_resurrect_requested, email_resurrection_completed, email_state_changed, email_stream_changed, email_stream_state_changed, email_stream_tags_changed, extra_automation_headers, - generate_publication_request ) + generate_publication_request, email_adopted ) from ietf.doc.utils import ( add_state_change_event, can_adopt_draft, get_tags_for_stream_id, nice_consensus, update_reminder, update_telechat, make_notify_changed_event, get_initial_notify, @@ -1301,8 +1301,7 @@ def adopt_draft(request, name): update_reminder(doc, "stream-s", e, due_date) - # TODO: Replace this with a message that's explicitly about the document adoption - email_stream_state_changed(request, doc, prev_state, new_state, by, comment) + email_adopted(request, doc, prev_state, new_state, by, comment) # comment if comment: diff --git a/ietf/mailtoken/migrations/0002_auto_20150809_1314.py b/ietf/mailtoken/migrations/0002_auto_20150809_1314.py index ac75d4919..b3a6cf96c 100644 --- a/ietf/mailtoken/migrations/0002_auto_20150809_1314.py +++ b/ietf/mailtoken/migrations/0002_auto_20150809_1314.py @@ -771,6 +771,18 @@ def make_mailtokens(apps): 'iesg_secretary', ]) + mt_factory(slug='doc_adopted_by_group', + desc="Recipients for notification that a document has been adopted by a group", + to_slugs=['doc_authors', + 'doc_group_chairs', + 'doc_group_mail_list', + ], + cc_slugs=['doc_ad', + 'doc_shepherd', + 'doc_notify', + ], + ) + def forward(apps, schema_editor): diff --git a/ietf/name/fixtures/names.json b/ietf/name/fixtures/names.json index 1bfb7923a..ddc958807 100644 --- a/ietf/name/fixtures/names.json +++ b/ietf/name/fixtures/names.json @@ -4961,6 +4961,23 @@ "model": "mailtoken.mailtoken", "pk": "conflrev_requested_iana" }, +{ + "fields": { + "cc": [ + "doc_ad", + "doc_notify", + "doc_shepherd" + ], + "to": [ + "doc_authors", + "doc_group_chairs", + "doc_group_mail_list" + ], + "desc": "Recipients for notification that a document has been adopted by a group" + }, + "model": "mailtoken.mailtoken", + "pk": "doc_adopted_by_group" +}, { "fields": { "cc": [ diff --git a/ietf/templates/doc/mail/doc_adopted_email.txt b/ietf/templates/doc/mail/doc_adopted_email.txt new file mode 100644 index 000000000..e8dd9bbeb --- /dev/null +++ b/ietf/templates/doc/mail/doc_adopted_email.txt @@ -0,0 +1,10 @@ +{% autoescape off %}{% filter wordwrap:73 %} +The {{ doc.group.acronym|upper }} {{ doc.group.type_id|upper }} has adopted {{ doc }} (entered by {{by}}) + +{% if prev_state %}The document was previously in state {{prev_state.name}} + +{% endif %}The document is available at {{ url }} +{% if comment %} + +Comment: +{{ comment }}{% endif %}{% endfilter %}{% endautoescape %}