summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--askbot/models/signals.py3
-rw-r--r--askbot/views/writers.py7
2 files changed, 9 insertions, 1 deletions
diff --git a/askbot/models/signals.py b/askbot/models/signals.py
index 4104ec62..42a9c787 100644
--- a/askbot/models/signals.py
+++ b/askbot/models/signals.py
@@ -31,6 +31,9 @@ new_answer_posted = django.dispatch.Signal(
new_question_posted = django.dispatch.Signal(
providing_args=['question', 'user', 'form_data']
)
+new_comment_posted = django.dispatch.Signal(
+ providing_args=['comment', 'user', 'form_data']
+)
answer_edited = django.dispatch.Signal(
providing_args=['answer', 'user', 'form_data']
)
diff --git a/askbot/views/writers.py b/askbot/views/writers.py
index 8379ba82..9890e579 100644
--- a/askbot/views/writers.py
+++ b/askbot/views/writers.py
@@ -720,9 +720,14 @@ def post_comments(request):#generic ajax handler to load comments to an object
'<a href="%(sign_in_url)s">sign in</a>.') % \
{'sign_in_url': url_utils.get_login_url()}
raise exceptions.PermissionDenied(msg)
- user.post_comment(
+ comment = user.post_comment(
parent_post=post, body_text=form.cleaned_data['comment']
)
+ signals.new_comment_posted.send(None,
+ comment=comment,
+ user=user,
+ form_data=form.cleaned_data
+ )
response = __generate_comments_json(post, user)
except exceptions.PermissionDenied, e:
response = HttpResponseForbidden(unicode(e), mimetype="application/json")