from xerxes.influences.models import Character,Influence
from xerxes.tools.notify import notify
from django.contrib.auth.models import Group
+from threadedcomments.models import ThreadedComment
def character_saved(**kwargs):
instance = kwargs['instance']
# TODO: Perhaps only notify when the status is / becomes Done?
notify([instance.character.player, 'lextalionis@evolution-events.nl'], 'influences/email/influence_changed.html', {'influence' : instance, 'created' : created})
-signals.post_save.connect(influence_saved, sender=Influence)
+def comment_saved(**kwargs):
+ if (settings.DEBUG):
+ return
+
+ comment = kwargs['instance']
+ # We don't support comment editing, but let's check this anyway
+ if not kwargs['created']:
+ return
+
+ object = comment.content_object
+ if isinstance(object, Influence):
+ notify(
+ [object.character.player, 'matthijs@stdin.nl'],
+ 'influences/email/influence_comment_added.html',
+ {'comment' : comment,
+ 'influence' : object,
+ 'commenter' : comment.user
+ }
+ )
+
+signals.post_save.connect(comment_saved, sender=ThreadedComment)
# vim: set sts=4 sw=4 expandtab: