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)
|
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]
|
||||||
|
@ -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")
|
||||||
|
|
||||||
@ -244,17 +247,18 @@ def notify_user(obj, event):
|
|||||||
if (obj != comment and
|
if (obj != comment and
|
||||||
comment.user_notification and comment.author_email):
|
comment.user_notification and comment.author_email):
|
||||||
emails.add(comment.author_email)
|
emails.add(comment.author_email)
|
||||||
|
|
||||||
if not emails:
|
if not emails:
|
||||||
return
|
return
|
||||||
|
|
||||||
subject = translate(_(u"A comment has been posted."),
|
subject = translate(_(u"A comment has been posted."),
|
||||||
context=obj.REQUEST)
|
context=obj.REQUEST)
|
||||||
message = translate(Message(
|
message = translate(Message(
|
||||||
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
|
||||||
|
@ -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.
|
||||||
|
Loading…
Reference in New Issue
Block a user