X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=influences%2Fnotify.py;h=ddcf37cea7b06c5770e98ee5f8be0eec2e03fe07;hb=89667723f59df28360a5e12dd969a8b190caa8d9;hp=e5c763ae36b40dea3d20b39d324233b8aad15378;hpb=419cb678949006d2c5bd6bf5a3176c67adf4cef7;p=matthijs%2Fprojects%2Fxerxes.git diff --git a/influences/notify.py b/influences/notify.py index e5c763a..ddcf37c 100644 --- a/influences/notify.py +++ b/influences/notify.py @@ -21,19 +21,26 @@ def influence_saved(**kwargs): # 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): + recipients = ['lextalionis@evolution-events.nl'] + if comment.is_public: + recipients.append(object.character.player) + notify( - [object.character.player, 'matthijs@stdin.nl'], + recipients, 'influences/email/influence_comment_added.html', {'comment' : comment, 'influence' : object,