summaryrefslogtreecommitdiff
path: root/app/lib/django_comments/signals.py
diff options
context:
space:
mode:
authorlxf <sng@luxagraf.net>2022-05-14 16:38:07 -0400
committerlxf <sng@luxagraf.net>2022-05-14 16:38:07 -0400
commitbb3973ffb714c932e9ec6dd6a751228dc71fe1d3 (patch)
tree6fa32f9392ad2ec32271349b86a4c1388fd6ba95 /app/lib/django_comments/signals.py
initial commit
Diffstat (limited to 'app/lib/django_comments/signals.py')
-rw-r--r--app/lib/django_comments/signals.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/app/lib/django_comments/signals.py b/app/lib/django_comments/signals.py
new file mode 100644
index 0000000..079afaf
--- /dev/null
+++ b/app/lib/django_comments/signals.py
@@ -0,0 +1,21 @@
+"""
+Signals relating to comments.
+"""
+from django.dispatch import Signal
+
+# Sent just before a comment will be posted (after it's been approved and
+# moderated; this can be used to modify the comment (in place) with posting
+# details or other such actions. If any receiver returns False the comment will be
+# discarded and a 400 response. This signal is sent at more or less
+# the same time (just before, actually) as the Comment object's pre-save signal,
+# except that the HTTP request is sent along with this signal.
+comment_will_be_posted = Signal(providing_args=["comment", "request"])
+
+# Sent just after a comment was posted. See above for how this differs
+# from the Comment object's post-save signal.
+comment_was_posted = Signal(providing_args=["comment", "request"])
+
+# Sent after a comment was "flagged" in some way. Check the flag to see if this
+# was a user requesting removal of a comment, a moderator approving/removing a
+# comment, or some other custom user flag.
+comment_was_flagged = Signal(providing_args=["comment", "flag", "created", "request"])