bugfix: send email only when notif created

This commit is contained in:
Matthieu Fesselier 2019-06-11 10:06:44 +08:00
parent c8bb171ea4
commit 3ae45a94c6

View File

@ -74,8 +74,8 @@ def send_request(target, object_iri):
@receiver(post_save, sender=Notification)
def send_email_on_notification(sender, instance, **kwargs):
if instance.summary and settings.JABBER_DEFAULT_HOST and instance.user.email:
def send_email_on_notification(sender, instance, created, **kwargs):
if created and instance.summary and settings.JABBER_DEFAULT_HOST and instance.user.email:
html_message = loader.render_to_string(
'email.html',
{