CC authors of patches on comments and reviews
authorMagnus Hagander <magnus@hagander.net>
Wed, 6 Apr 2016 15:45:27 +0000 (17:45 +0200)
committerMagnus Hagander <magnus@hagander.net>
Wed, 6 Apr 2016 15:45:27 +0000 (17:45 +0200)
This adds the Cc field when using the Review or the Comment function on
the website, and will add a list of all listed authors of the patch to
this. Should help people highlight it in their inboxes.

Suggested by José Luis Tallón

pgcommitfest/commitfest/views.py

index a6aee9c11a0c5a9b0c0554beee2ae23f59f35c73..5fda5b298fa8e62b8f9f80c102f318f62e04e358 100644 (file)
@@ -366,6 +366,12 @@ def comment(request, cfid, patchid, what):
 
                        msg['To'] = settings.HACKERS_EMAIL
                        msg['From'] = "%s %s <%s>" % (request.user.first_name, request.user.last_name, UserWrapper(request.user).email)
+
+                       # CC the authors of a patch, if there are any
+                       authors = list(patch.authors.all())
+                       if len(authors):
+                               msg['Cc'] = ", ".join(["%s %s <%s>" % (a.first_name, a.last_name, UserWrapper(a).email) for a in authors])
+
                        msg['Date'] = formatdate(localtime=True)
                        msg['User-Agent'] = 'pgcommitfest'
                        msg['X-cfsender'] = request.user.username