diff --git a/ietf/doc/mails.py b/ietf/doc/mails.py index 4cf2c8200..f2b7b45c7 100644 --- a/ietf/doc/mails.py +++ b/ietf/doc/mails.py @@ -417,6 +417,20 @@ def email_last_call_expired(doc): url=settings.IDTRACKER_BASE_URL + doc.get_absolute_url()), cc = addrs.cc) +def email_intended_status_changed(request, doc, text): + (to,cc) = gather_address_lists('doc_intended_status_changed',doc=doc) + + if not to: + return + + text = strip_tags(text) + send_mail(request, to, None, + "Intended Status for %s changed to %s" % (doc.file_tag(),doc.intended_std_level), + "doc/mail/intended_status_changed_email.txt", + dict(text=text, + url=settings.IDTRACKER_BASE_URL + doc.get_absolute_url()), + cc=cc) + def email_comment(request, doc, comment): (to, cc) = gather_address_lists('doc_added_comment',doc=doc) diff --git a/ietf/doc/tests_draft.py b/ietf/doc/tests_draft.py index f4a0a4cda..29eaa9e12 100644 --- a/ietf/doc/tests_draft.py +++ b/ietf/doc/tests_draft.py @@ -789,7 +789,10 @@ class IndividualInfoFormsTests(TestCase): self.doc = Document.objects.get(name=self.docname) self.assertEqual(self.doc.intended_std_level_id,'bcp') self.assertEqual(len(outbox),messages_before+1) + self.assertTrue('Intended Status ' in outbox[-1]['Subject']) + self.assertTrue('mars-chairs@' in outbox[-1]['To']) self.assertTrue('ZpyQFGmA' in str(outbox[-1])) + self.assertTrue('ZpyQFGmA' in self.doc.latest_event(DocEvent,type='added_comment').desc) def test_doc_change_telechat_date(self): diff --git a/ietf/doc/views_draft.py b/ietf/doc/views_draft.py index ab9ee420f..805ac0d17 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, email_adopted ) + generate_publication_request, email_adopted, email_intended_status_changed ) 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, @@ -449,8 +449,7 @@ def change_intention(request, name): doc.time = e.time doc.save() - # TODO: Build explicit changed_intended_publication_status - email_state_changed(request, doc, email_desc,'doc_state_edited') + email_intended_status_changed(request, doc, email_desc) return HttpResponseRedirect(doc.get_absolute_url()) diff --git a/ietf/mailtoken/migrations/0002_auto_20150809_1314.py b/ietf/mailtoken/migrations/0002_auto_20150809_1314.py index 06f4738cf..80e069a27 100644 --- a/ietf/mailtoken/migrations/0002_auto_20150809_1314.py +++ b/ietf/mailtoken/migrations/0002_auto_20150809_1314.py @@ -792,7 +792,15 @@ def make_mailtokens(apps): 'doc_non_ietf_stream_manager', ]) - + mt_factory(slug='doc_intended_status_changed', + desc="Recipients for a message when a document's intended publication status changes", + to_slugs=['doc_authors', + 'doc_group_chairs', + 'doc_shepherd', + 'doc_group_responsible_directors', + 'doc_non_ietf_stream_manager', + ]) + def forward(apps, schema_editor): make_recipients(apps) diff --git a/ietf/name/fixtures/names.json b/ietf/name/fixtures/names.json index 351ea48ea..a2c596529 100644 --- a/ietf/name/fixtures/names.json +++ b/ietf/name/fixtures/names.json @@ -5043,6 +5043,21 @@ "model": "mailtoken.mailtoken", "pk": "doc_iana_state_changed" }, +{ + "fields": { + "cc": [], + "to": [ + "doc_authors", + "doc_group_chairs", + "doc_group_responsible_directors", + "doc_non_ietf_stream_manager", + "doc_shepherd" + ], + "desc": "Recipients for a message when a document's intended publication status changes" + }, + "model": "mailtoken.mailtoken", + "pk": "doc_intended_status_changed" +}, { "fields": { "cc": [ diff --git a/ietf/templates/doc/mail/intended_status_changed_email.txt b/ietf/templates/doc/mail/intended_status_changed_email.txt new file mode 100644 index 000000000..c4efcd490 --- /dev/null +++ b/ietf/templates/doc/mail/intended_status_changed_email.txt @@ -0,0 +1,5 @@ +{% autoescape off %}{{ text }} + +The document can be found at +ID Tracker URL: {{ url }} +{% endautoescape %}