New explicit "Document has been adopted by group" message

- Legacy-Id: 10059
This commit is contained in:
Robert Sparks 2015-08-25 18:41:04 +00:00
parent e5a6ab4385
commit 9d239843e6
6 changed files with 63 additions and 6 deletions

View file

@ -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)

View file

@ -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)

View file

@ -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:

View file

@ -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):

View file

@ -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": [

View file

@ -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 %}