Skip to content

Commit 9d23984

Browse files
committed
New explicit "Document has been adopted by group" message
- Legacy-Id: 10059
1 parent e5a6ab4 commit 9d23984

6 files changed

Lines changed: 63 additions & 6 deletions

File tree

ietf/doc/mails.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,24 @@ def email_last_call_expired(doc):
417417
url=settings.IDTRACKER_BASE_URL + doc.get_absolute_url()),
418418
cc = addrs.cc)
419419

420+
def email_adopted(request, doc, prev_state, new_state, by, comment=""):
421+
(to, cc) = gather_address_lists('doc_adopted_by_group',doc=doc)
422+
423+
state_type = (prev_state or new_state).type
424+
425+
send_mail(request, to, settings.DEFAULT_FROM_EMAIL,
426+
u"The %s %s has adopted %s" %
427+
(doc.group.acronym.upper(),doc.group.type_id.upper(), doc.name),
428+
'doc/mail/doc_adopted_email.txt',
429+
dict(doc=doc,
430+
url=settings.IDTRACKER_BASE_URL + doc.get_absolute_url(),
431+
state_type=state_type,
432+
prev_state=prev_state,
433+
new_state=new_state,
434+
by=by,
435+
comment=comment),
436+
cc=cc)
437+
420438
def email_stream_state_changed(request, doc, prev_state, new_state, by, comment=""):
421439
(to, cc)= gather_address_lists('doc_stream_state_edited',doc=doc)
422440

ietf/doc/tests_draft.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,9 +1135,10 @@ def test_adopt_document(self):
11351135
self.assertEqual(draft.docevent_set.count() - events_before, 5)
11361136
self.assertEqual(draft.notify,"aliens@example.mars")
11371137
self.assertEqual(len(outbox), mailbox_before + 1)
1138-
self.assertTrue("state changed" in outbox[-1]["Subject"].lower())
1139-
self.assertTrue("mars-chairs@ietf.org" in unicode(outbox[-1]))
1140-
self.assertTrue("marsdelegate@ietf.org" in unicode(outbox[-1]))
1138+
self.assertTrue("has adopted" in outbox[-1]["Subject"].lower())
1139+
self.assertTrue("mars-chairs@ietf.org" in outbox[-1]['To'])
1140+
self.assertTrue("draft-ietf-mars-test@" in outbox[-1]['To'])
1141+
self.assertTrue("mars-wg@" in outbox[-1]['To'])
11411142

11421143
self.assertFalse(mars.list_email in draft.notify)
11431144

ietf/doc/views_draft.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from ietf.doc.mails import ( email_ad, email_pulled_from_rfc_queue, email_resurrect_requested,
2020
email_resurrection_completed, email_state_changed, email_stream_changed,
2121
email_stream_state_changed, email_stream_tags_changed, extra_automation_headers,
22-
generate_publication_request )
22+
generate_publication_request, email_adopted )
2323
from ietf.doc.utils import ( add_state_change_event, can_adopt_draft,
2424
get_tags_for_stream_id, nice_consensus,
2525
update_reminder, update_telechat, make_notify_changed_event, get_initial_notify,
@@ -1301,8 +1301,7 @@ def adopt_draft(request, name):
13011301

13021302
update_reminder(doc, "stream-s", e, due_date)
13031303

1304-
# TODO: Replace this with a message that's explicitly about the document adoption
1305-
email_stream_state_changed(request, doc, prev_state, new_state, by, comment)
1304+
email_adopted(request, doc, prev_state, new_state, by, comment)
13061305

13071306
# comment
13081307
if comment:

ietf/mailtoken/migrations/0002_auto_20150809_1314.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,18 @@ def mt_factory(slug,desc,to_slugs,cc_slugs=[]):
771771
'iesg_secretary',
772772
])
773773

774+
mt_factory(slug='doc_adopted_by_group',
775+
desc="Recipients for notification that a document has been adopted by a group",
776+
to_slugs=['doc_authors',
777+
'doc_group_chairs',
778+
'doc_group_mail_list',
779+
],
780+
cc_slugs=['doc_ad',
781+
'doc_shepherd',
782+
'doc_notify',
783+
],
784+
)
785+
774786

775787
def forward(apps, schema_editor):
776788

ietf/name/fixtures/names.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4961,6 +4961,23 @@
49614961
"model": "mailtoken.mailtoken",
49624962
"pk": "conflrev_requested_iana"
49634963
},
4964+
{
4965+
"fields": {
4966+
"cc": [
4967+
"doc_ad",
4968+
"doc_notify",
4969+
"doc_shepherd"
4970+
],
4971+
"to": [
4972+
"doc_authors",
4973+
"doc_group_chairs",
4974+
"doc_group_mail_list"
4975+
],
4976+
"desc": "Recipients for notification that a document has been adopted by a group"
4977+
},
4978+
"model": "mailtoken.mailtoken",
4979+
"pk": "doc_adopted_by_group"
4980+
},
49644981
{
49654982
"fields": {
49664983
"cc": [
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{% autoescape off %}{% filter wordwrap:73 %}
2+
The {{ doc.group.acronym|upper }} {{ doc.group.type_id|upper }} has adopted {{ doc }} (entered by {{by}})
3+
4+
{% if prev_state %}The document was previously in state {{prev_state.name}}
5+
6+
{% endif %}The document is available at {{ url }}
7+
{% if comment %}
8+
9+
Comment:
10+
{{ comment }}{% endif %}{% endfilter %}{% endautoescape %}

0 commit comments

Comments
 (0)