Fix comment link in email notification. This fixes http://dev.plone.org/plone/ticket/11413

svn path=/plone.app.discussion/trunk/; revision=49031
This commit is contained in:
Timo Stollenwerk 2011-04-22 12:47:29 +00:00
parent 49504c1ddd
commit f8c39c1b87
3 changed files with 18 additions and 5 deletions

View File

@ -1,6 +1,17 @@
Changelog Changelog
========= =========
2.0.1 (2011-04-22)
------------------
- Fix comment link in email notification. This fixes
http://dev.plone.org/plone/ticket/11413.
[timo]
- Redirect to the comment itself when notifying a user about a new comment.
[timo]
2.0 (2011-04-21) 2.0 (2011-04-21)
---------------- ----------------

View File

@ -253,8 +253,9 @@ def notify_user(obj, event):
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': obj.absolute_url()}), 'link': content_object.absolute_url() +
context=obj.REQUEST) '/view#' + obj.id}),
context=obj.REQUEST)
for email in emails: for email in emails:
# Send email # Send email
try: try:
@ -313,7 +314,8 @@ def notify_moderator(obj, event):
subject = translate(_(u"A comment has been posted."), context=obj.REQUEST) subject = translate(_(u"A comment has been posted."), context=obj.REQUEST)
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': obj.absolute_url()}), 'link': content_object.absolute_url() +
'/view#' + obj.id}),
context=obj.REQUEST) context=obj.REQUEST)
# Send email # Send email

View File

@ -84,7 +84,7 @@ class TestUserNotificationUnit(unittest.TestCase):
"A comment on \'K=C3=B6lle Alaaf\' has been posted here:" "A comment on \'K=C3=B6lle Alaaf\' has been posted here:"
in msg) in msg)
self.assertTrue( self.assertTrue(
"http://nohost/plone/d=\noc1/++conversation++default/%s" "http://nohost/plone/d=\noc1/view#%s"
% comment_id % comment_id
in msg) in msg)
@ -217,7 +217,7 @@ class TestModeratorNotificationUnit(unittest.TestCase):
"A comment on \'K=C3=B6lle Alaaf\' has been posted here:" "A comment on \'K=C3=B6lle Alaaf\' has been posted here:"
in msg) in msg)
self.assertTrue( self.assertTrue(
"http://nohost/plone/d=\noc1/++conversation++default/%s" "http://nohost/plone/d=\noc1/view#%s"
% comment_id % comment_id
in msg) in msg)