New explicit "Comment has been added to document history" message

- Legacy-Id: 10060
This commit is contained in:
Robert Sparks 2015-08-25 20:05:11 +00:00
parent 9d239843e6
commit 5c13bddd77
6 changed files with 55 additions and 6 deletions

View file

@ -417,6 +417,20 @@ def email_last_call_expired(doc):
url=settings.IDTRACKER_BASE_URL + doc.get_absolute_url()),
cc = addrs.cc)
def email_comment(request, doc, comment):
(to, cc) = gather_address_lists('doc_added_comment',doc=doc)
send_mail(request, to, None, "Comment added to %s history"%doc.name,
"doc/mail/comment_added_email.txt",
dict(
comment=comment,
doc=doc,
by=request.user.person,
url=settings.IDTRACKER_BASE_URL + doc.get_absolute_url(),
),
cc = cc)
def email_adopted(request, doc, prev_state, new_state, by, comment=""):
(to, cc) = gather_address_lists('doc_adopted_by_group',doc=doc)

View file

@ -718,8 +718,9 @@ class AddCommentTestCase(TestCase):
self.assertEqual("This is a test.", draft.latest_event().desc)
self.assertEqual("added_comment", draft.latest_event().type)
self.assertEqual(len(outbox), mailbox_before + 1)
self.assertTrue("updated" in outbox[-1]['Subject'])
self.assertTrue("Comment added" in outbox[-1]['Subject'])
self.assertTrue(draft.name in outbox[-1]['Subject'])
self.assertTrue('draft-ietf-mars-test@' in outbox[-1]['To'])
# Make sure we can also do it as IANA
self.client.login(username="iana", password="iana+password")

View file

@ -58,7 +58,7 @@ from ietf.name.models import StreamName, BallotPositionName
from ietf.person.models import Email
from ietf.utils.history import find_history_active_at
from ietf.doc.forms import TelechatForm, NotifyForm
from ietf.doc.mails import email_ad
from ietf.doc.mails import email_comment
from ietf.mailtoken.utils import gather_relevant_expansions
def render_document_top(request, doc, tab, name):
@ -906,10 +906,8 @@ def add_comment(request, name):
e.desc = c
e.save()
if doc.type_id == "draft":
# TODO - build an explicit message for when a comment is added
email_ad(request, doc, doc.ad, login,
"A new comment added by %s" % login.name)
email_comment(request, doc, e)
return redirect("doc_history", name=doc.name)
else:
form = AddCommentForm()

View file

@ -783,6 +783,15 @@ def make_mailtokens(apps):
],
)
mt_factory(slug='doc_added_comment',
desc="Recipients for a message when a new comment is manually entered into the document's history",
to_slugs=['doc_authors',
'doc_group_chairs',
'doc_shepherd',
'doc_group_responsible_directors',
'doc_non_ietf_stream_manager',
])
def forward(apps, schema_editor):

View file

@ -4961,6 +4961,21 @@
"model": "mailtoken.mailtoken",
"pk": "conflrev_requested_iana"
},
{
"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 new comment is manually entered into the document's history"
},
"model": "mailtoken.mailtoken",
"pk": "doc_added_comment"
},
{
"fields": {
"cc": [

View file

@ -0,0 +1,12 @@
{% autoescape off %}
Please DO NOT reply to this email.
{{by}} added the following comment to the history of {{doc.name}}
{{ comment.desc }}
The document can be found at
I-D: {{ doc.file_tag|safe }}
ID Tracker URL: {{ url }}
{% endautoescape%}