changeset 3484:be7c5a205cc2

Regression fix: send page diff url in notification emails
author Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
date Sun, 06 Apr 2008 21:19:03 +0000
parents 0392c7258982
children 79d7bce1095c
files MoinMoin/events/emailnotify.py MoinMoin/events/notification.py
diffstat 2 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/events/emailnotify.py	Sun Apr 06 20:02:43 2008 +0200
+++ b/MoinMoin/events/emailnotify.py	Sun Apr 06 21:19:03 2008 +0000
@@ -35,6 +35,15 @@
     change = notification.page_change_message("page_changed", request, page, email_lang, comment=comment, revisions=revisions)
     _ = lambda s, wiki=False, r=request, l=email_lang: r.getText(s, wiki=wiki, lang=l)
 
+    if len(revisions) >= 2:
+        querystr = {'action': 'diff',
+                    'rev2': str(revisions[0]),
+                    'rev1': str(revisions[1])}
+    else:
+        querystr = {}
+
+    pagelink = "%(link)s\n\n" % {'link': notification.page_link(request, page, querystr)}
+
     subject = _('[%(sitename)s] %(trivial)sUpdate of "%(pagename)s" by %(username)s') % {
             'trivial': (trivial and _("Trivial ")) or "",
             'sitename': page.cfg.sitename or "Wiki",
@@ -42,7 +51,7 @@
             'username': page.uid_override or user.getUserIdentification(request),
         }
 
-    return {'subject': subject, 'body': change['text'] + change['diff']}
+    return {'subject': subject, 'body': change['text'] + pagelink + change['diff']}
 
 
 def send_notification(request, from_address, emails, data):
--- a/MoinMoin/events/notification.py	Sun Apr 06 20:02:43 2008 +0200
+++ b/MoinMoin/events/notification.py	Sun Apr 06 21:19:03 2008 +0000
@@ -76,7 +76,7 @@
     if msgtype == "page_changed":
         changes['text'] = _("Dear Wiki user,\n\n"
         'You have subscribed to a wiki page or wiki category on "%(sitename)s" for change notification.\n\n'
-        'The "%(pagename)s" page has been changed by %(editor)s:\n\n') % {
+        'The "%(pagename)s" page has been changed by %(editor)s:\n') % {
             'pagename': page.page_name,
             'editor': page.uid_override or user.getUserIdentification(request),
             'sitename': page.cfg.sitename or request.getBaseURL(),