~sirodoht/mataroa

0cb8648a5086a7ad0cc3e6d5c6c6355c596c0449 — Theodore Keloglou 3 months ago fefc687
add process notification in case notification is none
1 files changed, 8 insertions(+), 0 deletions(-)

M main/management/commands/process_notifications.py
M main/management/commands/process_notifications.py => main/management/commands/process_notifications.py +8 -0
@@ 102,6 102,14 @@ class Command(BaseCommand):
                record.delete()
                continue

            # don't send, if there is no notification object attached
            if record.notification is None:
                # also delete record
                msg = f"Delete as notifications off: '{record.post.title}' as there is no record.notification attached."
                self.stdout.write(self.style.NOTICE(msg))
                record.delete()
                continue

            # don't send, if email has unsubscribed since records were enqueued
            if not record.notification.is_active:
                # also delete record