From df112c8cfa355e6c3d78f0c11cbb58996f696ba1 Mon Sep 17 00:00:00 2001 From: afabiani Date: Mon, 23 Nov 2020 13:35:32 +0100 Subject: [PATCH] - Fix LGTM issues --- geonode/base/models.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/geonode/base/models.py b/geonode/base/models.py index 1cd6815613b..e3545bfd978 100644 --- a/geonode/base/models.py +++ b/geonode/base/models.py @@ -877,7 +877,6 @@ def save(self, notify=False, *args, **kwargs): """ Send a notification when a resource is created or updated """ - _notification_sent = False if hasattr(self, 'class_name') and (self.pk is None or notify): if self.pk is None and self.title: # Resource Created @@ -885,9 +884,9 @@ def save(self, notify=False, *args, **kwargs): notice_type_label = '%s_created' % self.class_name.lower() recipients = get_notification_recipients(notice_type_label, resource=self) send_notification(recipients, notice_type_label, {'resource': self}) - _notification_sent = True elif self.pk: # Resource Updated + _notification_sent = False # Approval Notifications Here if not _notification_sent and settings.ADMIN_MODERATE_UPLOADS: @@ -899,6 +898,7 @@ def save(self, notify=False, *args, **kwargs): notice_type_label = '%s_approved' % self.class_name.lower() recipients = get_notification_recipients(notice_type_label, resource=self) send_notification(recipients, notice_type_label, {'resource': self}) + _notification_sent = True # Publishing Notifications Here if not _notification_sent and settings.RESOURCE_PUBLISHING: @@ -910,6 +910,7 @@ def save(self, notify=False, *args, **kwargs): notice_type_label = '%s_published' % self.class_name.lower() recipients = get_notification_recipients(notice_type_label, resource=self) send_notification(recipients, notice_type_label, {'resource': self}) + _notification_sent = True # Updated Notifications Here if not _notification_sent: