Provide the comment body text in the email notification.
svn path=/plone.app.discussion/trunk/; revision=49032
This commit is contained in:
parent
f8c39c1b87
commit
31ecf38129
@ -4,6 +4,9 @@ Changelog
|
||||
2.0.1 (2011-04-22)
|
||||
------------------
|
||||
|
||||
- Provide the comment body text in the email notification.
|
||||
[timo]
|
||||
|
||||
- Fix comment link in email notification. This fixes
|
||||
http://dev.plone.org/plone/ticket/11413.
|
||||
[timo]
|
||||
|
@ -52,7 +52,10 @@ COMMENT_TITLE = _(u"comment_title",
|
||||
|
||||
MAIL_NOTIFICATION_MESSAGE = _(u"mail_notification_message",
|
||||
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")
|
||||
|
||||
@ -244,17 +247,18 @@ def notify_user(obj, event):
|
||||
if (obj != comment and
|
||||
comment.user_notification and comment.author_email):
|
||||
emails.add(comment.author_email)
|
||||
|
||||
|
||||
if not emails:
|
||||
return
|
||||
|
||||
|
||||
subject = translate(_(u"A comment has been posted."),
|
||||
context=obj.REQUEST)
|
||||
message = translate(Message(
|
||||
MAIL_NOTIFICATION_MESSAGE,
|
||||
mapping={'title': safe_unicode(content_object.title),
|
||||
'link': content_object.absolute_url() +
|
||||
'/view#' + obj.id}),
|
||||
'/view#' + obj.id,
|
||||
'text': obj.text}),
|
||||
context=obj.REQUEST)
|
||||
for email in emails:
|
||||
# Send email
|
||||
@ -315,7 +319,8 @@ def notify_moderator(obj, event):
|
||||
message = translate(Message(MAIL_NOTIFICATION_MESSAGE,
|
||||
mapping={'title': safe_unicode(content_object.title),
|
||||
'link': content_object.absolute_url() +
|
||||
'/view#' + obj.id}),
|
||||
'/view#' + obj.id,
|
||||
'text': obj.text}),
|
||||
context=obj.REQUEST)
|
||||
|
||||
# Send email
|
||||
|
@ -87,6 +87,7 @@ class TestUserNotificationUnit(unittest.TestCase):
|
||||
"http://nohost/plone/d=\noc1/view#%s"
|
||||
% comment_id
|
||||
in msg)
|
||||
self.assertTrue('Comment text' in msg)
|
||||
|
||||
def test_do_not_notify_user_when_notification_is_disabled(self):
|
||||
registry = queryUtility(IRegistry)
|
||||
@ -220,6 +221,7 @@ class TestModeratorNotificationUnit(unittest.TestCase):
|
||||
"http://nohost/plone/d=\noc1/view#%s"
|
||||
% comment_id
|
||||
in msg)
|
||||
self.assertTrue('Comment text' in msg)
|
||||
|
||||
def test_notify_moderator_specific_address(self):
|
||||
# A moderator email address can be specified in the control panel.
|
||||
|
Loading…
Reference in New Issue
Block a user