Skip to content
This repository

Notifier commenters of replies via email #511

wants to merge 1 commit into from

2 participants

renwofei423 Stephen McDonald

Send email to reply or post people,instead of ADMINS.
I think it will more useful.

renwofei423 Update mezzanine/generic/
send email to reply or post people,instead of ADMINS
Stephen McDonald

Hey there, thanks a lot for submitting this.

There's quite a bit more work that would be involved in implementing it properly:

  • The code references blog posts explicitly, but comments can be associated with any model. We'd need a generic way to look up the model, and it'd also need to check a Boolean field on that model (called say email_replies, defaulting to False) to see if the author of the blog post even wants comments email to them, since they might not!
  • No option is given to the commenter (or even the blog post author as I mentioned) to let them control whether or not they want emails sent to them, so we don't even have their permission to do so. We'd need another new Boolean field on the comment model (also defaulting to False) for the commenter to flag that they actually want email sent to them. Also with that in place, the email would need an unsubscribe link so that the commenter could choose to stop receiving emails. This would need to be a separate email send by the way, since the unsubscribe link would be specific to the commenter, not the blog post author.
  • The way it's implemented, if it finds emails to send to, it ends up ignoring the COMMENTS_NOTIFICATION_EMAILS setting entirely. They should still get the same email, along with the blog author if the setup above is implemented.
  • There's an empty except clause - what error is being trapped? There's probably no need for this with all of the above implemented more granularly.

Thanks again for kicking this off - it'll be a great addition with the above implemented.

Stephen McDonald stephenmcd closed this December 22, 2012
Stephen McDonald stephenmcd reopened this December 22, 2012
Stephen McDonald

Sorry, no need to close this really. Let's leave it open.


Sorry! The application scene is in our cmpany,which might be mandatory in some way. I didn't think that much.

Time permitted,I will try to improve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Dec 20, 2012
renwofei423 Update mezzanine/generic/
send email to reply or post people,instead of ADMINS
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 13 additions and 2 deletions. Show diff stats Hide diff stats

  1. 15  mezzanine/generic/
15  mezzanine/generic/
... ...
@@ -1,4 +1,3 @@
2 1
 from django.contrib.admin.views.decorators import staff_member_required
3 2
 from django.contrib.messages import error
4 3
 from django.contrib.comments.signals import comment_was_posted
@@ -83,7 +82,19 @@ def comment(request, template="generic/comments.html"):
83 82
84 83
         # Send notification emails.
85 84
         comment_url = add_cache_bypass(comment.get_absolute_url())
-        notify_emails = filter(None, [addr.strip() for addr in
+        #=======================================================================
+        # send email to reply or post people,instead of ADMINS
+        #=======================================================================
+        try:
+            from import BlogPost
+            notify_emails = [BlogPost.objects.get(id=comment.object_pk)]
+            if comment.threadedcomment.replied_to != None:
+                other_email = comment.threadedcomment.replied_to.user_email             
+                notify_emails += [other_email]
+#            print notify_emails
+        except:            
+            notify_emails = filter(None, [addr.strip() for addr in
87 98
88 99
         if notify_emails:
89 100
             subject = _("New comment for: ") + unicode(obj)

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.