summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dpmcgee@gmail.com>2010-08-13 09:04:04 -0500
committerDan McGee <dpmcgee@gmail.com>2010-08-13 09:04:04 -0500
commitb750d97493d25e14aad563ab8e9e9f9b9c606539 (patch)
treefe9f78b66242103ffa1a5bc24dcbcee2ff533025
parent41fa83f94a04db7273a3c7884eb32a43bdf7d5eb (diff)
downloadwebsite-b750d97493d25e14aad563ab8e9e9f9b9c606539.tar.gz
website-b750d97493d25e14aad563ab8e9e9f9b9c606539.zip
Don't send emails or check my own comments
I'm fairly certain I know that I posted on my own blog. Signed-off-by: Dan McGee <dpmcgee@gmail.com>
-rw-r--r--mycomments/signals.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/mycomments/signals.py b/mycomments/signals.py
index 8357054..c94e868 100644
--- a/mycomments/signals.py
+++ b/mycomments/signals.py
@@ -10,6 +10,9 @@ def send_comment_by_mail(sender, **kwargs):
comment = kwargs['comment']
if comment.content_type.model_class() != Post:
return
+ # if the comment has a logged-in user, we don't need an email
+ if comment.user:
+ return
post = Post.objects.get(id__exact = comment.object_pk)
commenturl = 'http://%s%s' % ( Site.objects.get_current().domain,
@@ -46,6 +49,9 @@ def check_spam_comment(sender, **kwargs):
post = Post.objects.get(id__exact = comment.object_pk)
if not post.comments_enabled:
return False
+ # if the comment has a logged-in user, we don't to check it
+ if comment.user:
+ return True
ip_ct = BannedIP.objects.filter(ip_address=comment.ip_address).count()
un_ct = BannedUserName.objects.filter(user_name=comment.user_name).count()
if ip_ct > 0 or un_ct > 0: