From: Matthijs Kooijman Date: Mon, 16 Feb 2009 19:23:06 +0000 (+0100) Subject: Only notify a player of finished influence changes. X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fprojects%2Fxerxes.git;a=commitdiff_plain;h=08ad5cd72af1795f3e0750413bcdbbee54c14c25 Only notify a player of finished influence changes. SLs are notified of any change, but players only receive email notification of influences that are marked as done, to reduce noise. --- diff --git a/influences/notify.py b/influences/notify.py index ddcf37c..daffadf 100644 --- a/influences/notify.py +++ b/influences/notify.py @@ -18,8 +18,10 @@ def influence_saved(**kwargs): instance = kwargs['instance'] created = kwargs['created'] if (not settings.DEBUG): - # 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}) + recipients = ['lextalionis@evolution-events.nl'] + if instance.status == 'D': + recipients.append(instance.character.player) + notify(recipients, 'influences/email/influence_changed.html', {'influence' : instance, 'created' : created}) signals.post_save.connect(influence_saved, sender=Influence)