From f8c39c1b87051fe3f65d3f635f136946a058087f Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Fri, 22 Apr 2011 12:47:29 +0000 Subject: [PATCH] Fix comment link in email notification. This fixes http://dev.plone.org/plone/ticket/11413 svn path=/plone.app.discussion/trunk/; revision=49031 --- CHANGES.txt | 11 +++++++++++ plone/app/discussion/comment.py | 8 +++++--- plone/app/discussion/tests/test_notifications.py | 4 ++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 394bf50..ed3180c 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,17 @@ 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) ---------------- diff --git a/plone/app/discussion/comment.py b/plone/app/discussion/comment.py index 9bce01b..0993b00 100644 --- a/plone/app/discussion/comment.py +++ b/plone/app/discussion/comment.py @@ -253,8 +253,9 @@ def notify_user(obj, event): message = translate(Message( MAIL_NOTIFICATION_MESSAGE, mapping={'title': safe_unicode(content_object.title), - 'link': obj.absolute_url()}), - context=obj.REQUEST) + 'link': content_object.absolute_url() + + '/view#' + obj.id}), + context=obj.REQUEST) for email in emails: # Send email try: @@ -313,7 +314,8 @@ def notify_moderator(obj, event): 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': obj.absolute_url()}), + 'link': content_object.absolute_url() + + '/view#' + obj.id}), context=obj.REQUEST) # Send email diff --git a/plone/app/discussion/tests/test_notifications.py b/plone/app/discussion/tests/test_notifications.py index 155ffe4..23902b7 100644 --- a/plone/app/discussion/tests/test_notifications.py +++ b/plone/app/discussion/tests/test_notifications.py @@ -84,7 +84,7 @@ class TestUserNotificationUnit(unittest.TestCase): "A comment on \'K=C3=B6lle Alaaf\' has been posted here:" in msg) self.assertTrue( - "http://nohost/plone/d=\noc1/++conversation++default/%s" + "http://nohost/plone/d=\noc1/view#%s" % comment_id in msg) @@ -217,7 +217,7 @@ class TestModeratorNotificationUnit(unittest.TestCase): "A comment on \'K=C3=B6lle Alaaf\' has been posted here:" in msg) self.assertTrue( - "http://nohost/plone/d=\noc1/++conversation++default/%s" + "http://nohost/plone/d=\noc1/view#%s" % comment_id in msg)