]> git.ozlabs.org Git - patchwork/commitdiff
notifications: add project name to patch update notification
authorWolfram Sang <wsa@the-dreams.de>
Fri, 17 May 2013 10:23:05 +0000 (12:23 +0200)
committerJeremy Kerr <jk@ozlabs.org>
Sun, 16 Jun 2013 09:25:44 +0000 (17:25 +0800)
Based on a feature request & patch from Wolfram Sang
<wsa@the-dreams.de>.

Notifications may span multiple projects, so include a summary in the
subject line, and detail in the header.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
apps/patchwork/utils.py
templates/patchwork/patch-change-notification-subject.text
templates/patchwork/patch-change-notification.mail

index f48e7a59a341ada3bc9a1465c809f181dac4cd3a..f8fee3fcaaa1c8d0db9e5d50b4989ac75ae9ef3c 100644 (file)
@@ -175,6 +175,7 @@ def send_notifications():
 
     for (recipient, notifications) in groups:
         notifications = list(notifications)
 
     for (recipient, notifications) in groups:
         notifications = list(notifications)
+        projects = set([ n.patch.project.linkname for n in notifications ])
 
         def delete_notifications():
             PatchChangeNotification.objects.filter(
 
         def delete_notifications():
             PatchChangeNotification.objects.filter(
@@ -188,7 +189,9 @@ def send_notifications():
             'site': Site.objects.get_current(),
             'person': recipient,
             'notifications': notifications,
             'site': Site.objects.get_current(),
             'person': recipient,
             'notifications': notifications,
+            'projects': projects,
         }
         }
+
         subject = render_to_string(
                         'patchwork/patch-change-notification-subject.text',
                         context).strip()
         subject = render_to_string(
                         'patchwork/patch-change-notification-subject.text',
                         context).strip()
index 02ee55b5f484df259793fbaec68cc5c5d543fed2..c9d96d4113e26929804573b3b424da17998236e4 100644 (file)
@@ -1 +1 @@
-Patch update notification: {{notifications|length}} patch{{notifications|length|pluralize:"es"}} updated
+[{{ projects|join:"," }}] Patch notification: {{notifications|length}} patch{{notifications|length|pluralize:"es"}} updated
index 19a2a09a16926009b25525fcf0c92a88507e60b2..b7e2cfecc1a1fc8ac0447b4dd92127342f2b9571 100644 (file)
@@ -2,8 +2,9 @@ Hello,
 
 The following patch{{notifications|length|pluralize:"es"}} (submitted by you) {{notifications|length|pluralize:"has,have"}} been updated in patchwork:
 {% for notification in notifications %}
 
 The following patch{{notifications|length|pluralize:"es"}} (submitted by you) {{notifications|length|pluralize:"has,have"}} been updated in patchwork:
 {% for notification in notifications %}
- * {{notification.patch.name|safe}}
+ * {{notification.patch.project.linkname}}: {{notification.patch.name|safe}}
      - http://{{site.domain}}{{notification.patch.get_absolute_url}}
      - http://{{site.domain}}{{notification.patch.get_absolute_url}}
+     - for: {{notification.patch.project.name}}
     was: {{notification.orig_state}}
     now: {{notification.patch.state}}
 {% endfor %}
     was: {{notification.orig_state}}
     now: {{notification.patch.state}}
 {% endfor %}