Skip to content

Commit 5c13bdd

Browse files
committed
New explicit "Comment has been added to document history" message
- Legacy-Id: 10060
1 parent 9d23984 commit 5c13bdd

6 files changed

Lines changed: 55 additions & 6 deletions

File tree

ietf/doc/mails.py

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

420+
def email_comment(request, doc, comment):
421+
(to, cc) = gather_address_lists('doc_added_comment',doc=doc)
422+
423+
send_mail(request, to, None, "Comment added to %s history"%doc.name,
424+
"doc/mail/comment_added_email.txt",
425+
dict(
426+
comment=comment,
427+
doc=doc,
428+
by=request.user.person,
429+
url=settings.IDTRACKER_BASE_URL + doc.get_absolute_url(),
430+
),
431+
cc = cc)
432+
433+
420434
def email_adopted(request, doc, prev_state, new_state, by, comment=""):
421435
(to, cc) = gather_address_lists('doc_adopted_by_group',doc=doc)
422436

ietf/doc/tests.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,8 +718,9 @@ def test_add_comment(self):
718718
self.assertEqual("This is a test.", draft.latest_event().desc)
719719
self.assertEqual("added_comment", draft.latest_event().type)
720720
self.assertEqual(len(outbox), mailbox_before + 1)
721-
self.assertTrue("updated" in outbox[-1]['Subject'])
721+
self.assertTrue("Comment added" in outbox[-1]['Subject'])
722722
self.assertTrue(draft.name in outbox[-1]['Subject'])
723+
self.assertTrue('draft-ietf-mars-test@' in outbox[-1]['To'])
723724

724725
# Make sure we can also do it as IANA
725726
self.client.login(username="iana", password="iana+password")

ietf/doc/views_doc.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
from ietf.person.models import Email
5959
from ietf.utils.history import find_history_active_at
6060
from ietf.doc.forms import TelechatForm, NotifyForm
61-
from ietf.doc.mails import email_ad
61+
from ietf.doc.mails import email_comment
6262
from ietf.mailtoken.utils import gather_relevant_expansions
6363

6464
def render_document_top(request, doc, tab, name):
@@ -906,10 +906,8 @@ def add_comment(request, name):
906906
e.desc = c
907907
e.save()
908908

909-
if doc.type_id == "draft":
910-
# TODO - build an explicit message for when a comment is added
911-
email_ad(request, doc, doc.ad, login,
912-
"A new comment added by %s" % login.name)
909+
email_comment(request, doc, e)
910+
913911
return redirect("doc_history", name=doc.name)
914912
else:
915913
form = AddCommentForm()

ietf/mailtoken/migrations/0002_auto_20150809_1314.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,15 @@ def mt_factory(slug,desc,to_slugs,cc_slugs=[]):
783783
],
784784
)
785785

786+
mt_factory(slug='doc_added_comment',
787+
desc="Recipients for a message when a new comment is manually entered into the document's history",
788+
to_slugs=['doc_authors',
789+
'doc_group_chairs',
790+
'doc_shepherd',
791+
'doc_group_responsible_directors',
792+
'doc_non_ietf_stream_manager',
793+
])
794+
786795

787796
def forward(apps, schema_editor):
788797

ietf/name/fixtures/names.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4961,6 +4961,21 @@
49614961
"model": "mailtoken.mailtoken",
49624962
"pk": "conflrev_requested_iana"
49634963
},
4964+
{
4965+
"fields": {
4966+
"cc": [],
4967+
"to": [
4968+
"doc_authors",
4969+
"doc_group_chairs",
4970+
"doc_group_responsible_directors",
4971+
"doc_non_ietf_stream_manager",
4972+
"doc_shepherd"
4973+
],
4974+
"desc": "Recipients for a message when a new comment is manually entered into the document's history"
4975+
},
4976+
"model": "mailtoken.mailtoken",
4977+
"pk": "doc_added_comment"
4978+
},
49644979
{
49654980
"fields": {
49664981
"cc": [
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{% autoescape off %}
2+
Please DO NOT reply to this email.
3+
4+
{{by}} added the following comment to the history of {{doc.name}}
5+
6+
{{ comment.desc }}
7+
8+
The document can be found at
9+
I-D: {{ doc.file_tag|safe }}
10+
ID Tracker URL: {{ url }}
11+
12+
{% endautoescape%}

0 commit comments

Comments
 (0)