Provide the comment body text in the email notification.

svn path=/plone.app.discussion/trunk/; revision=49032
This commit is contained in:
Timo Stollenwerk 2011-04-22 13:34:50 +00:00
parent f8c39c1b87
commit 31ecf38129
3 changed files with 15 additions and 5 deletions

View File

@ -4,6 +4,9 @@ Changelog
2.0.1 (2011-04-22) 2.0.1 (2011-04-22)
------------------ ------------------
- Provide the comment body text in the email notification.
[timo]
- Fix comment link in email notification. This fixes - Fix comment link in email notification. This fixes
http://dev.plone.org/plone/ticket/11413. http://dev.plone.org/plone/ticket/11413.
[timo] [timo]

View File

@ -52,7 +52,10 @@ COMMENT_TITLE = _(u"comment_title",
MAIL_NOTIFICATION_MESSAGE = _(u"mail_notification_message", MAIL_NOTIFICATION_MESSAGE = _(u"mail_notification_message",
default=u"A comment on '${title}' " default=u"A comment on '${title}' "
"has been posted here: ${link}") "has been posted here: ${link}\n\n"
"---\n\n"
"${text}"
"---\n")
logger = logging.getLogger("plone.app.discussion") logger = logging.getLogger("plone.app.discussion")
@ -254,7 +257,8 @@ def notify_user(obj, event):
MAIL_NOTIFICATION_MESSAGE, MAIL_NOTIFICATION_MESSAGE,
mapping={'title': safe_unicode(content_object.title), mapping={'title': safe_unicode(content_object.title),
'link': content_object.absolute_url() + 'link': content_object.absolute_url() +
'/view#' + obj.id}), '/view#' + obj.id,
'text': obj.text}),
context=obj.REQUEST) context=obj.REQUEST)
for email in emails: for email in emails:
# Send email # Send email
@ -315,7 +319,8 @@ def notify_moderator(obj, event):
message = translate(Message(MAIL_NOTIFICATION_MESSAGE, message = translate(Message(MAIL_NOTIFICATION_MESSAGE,
mapping={'title': safe_unicode(content_object.title), mapping={'title': safe_unicode(content_object.title),
'link': content_object.absolute_url() + 'link': content_object.absolute_url() +
'/view#' + obj.id}), '/view#' + obj.id,
'text': obj.text}),
context=obj.REQUEST) context=obj.REQUEST)
# Send email # Send email

View File

@ -87,6 +87,7 @@ class TestUserNotificationUnit(unittest.TestCase):
"http://nohost/plone/d=\noc1/view#%s" "http://nohost/plone/d=\noc1/view#%s"
% comment_id % comment_id
in msg) in msg)
self.assertTrue('Comment text' in msg)
def test_do_not_notify_user_when_notification_is_disabled(self): def test_do_not_notify_user_when_notification_is_disabled(self):
registry = queryUtility(IRegistry) registry = queryUtility(IRegistry)
@ -220,6 +221,7 @@ class TestModeratorNotificationUnit(unittest.TestCase):
"http://nohost/plone/d=\noc1/view#%s" "http://nohost/plone/d=\noc1/view#%s"
% comment_id % comment_id
in msg) in msg)
self.assertTrue('Comment text' in msg)
def test_notify_moderator_specific_address(self): def test_notify_moderator_specific_address(self):
# A moderator email address can be specified in the control panel. # A moderator email address can be specified in the control panel.