Actually deliver CCed emails to patch authors
authorMagnus Hagander <magnus@hagander.net>
Sat, 20 Jan 2018 13:19:35 +0000 (14:19 +0100)
committerMagnus Hagander <magnus@hagander.net>
Sat, 20 Jan 2018 13:19:35 +0000 (14:19 +0100)
Previously we would set the Cc header of the email, but not actually
send a copy to the user. That way if the user was not subscribed to the
hackers email, they'd end up not receiving the email at all, which
somewhat defeats one of the original points of adding the Cc in the
first place.

Spotted by Peter Geoghegan

pgcommitfest/commitfest/views.py

index c3007b28adbfcd7a2b6ab57544fff823bb7b6f2d..d8093404e7b536a117d6c6513206c774cafd1215 100644 (file)
@@ -382,7 +382,13 @@ def comment(request, cfid, patchid, what):
                        msg['References'] = '<%s> <%s>' % (form.thread.messageid, form.respid)
                        msg['Message-ID'] = make_msgid('pgcf')
 
-                       send_mail(UserWrapper(request.user).email, settings.HACKERS_EMAIL, msg.as_string())
+                       uw = UserWrapper(request.user)
+                       msgstring = msg.as_string()
+                       send_mail(uw.email, settings.HACKERS_EMAIL, msgstring)
+                       for a in authors:
+                               # Actually send a copy directly to the author. Just setting the Cc field doesn't
+                               # make it deliver the email...
+                               send_mail(uw.email, UserWrapper(a).email, msgstring)
 
                        PatchHistory(patch=patch, by=request.user, what='Posted %s with messageid %s' % (what, msg['Message-ID'])).save()