From 9ca872108096d0a351e476899d6142cf6e55c8ea Mon Sep 17 00:00:00 2001 From: Ostap Zherebetskyi Date: Thu, 4 Jun 2026 17:31:43 +0300 Subject: [PATCH] Filter notifications to only include unsent notifications in email tasks --- notifications/tasks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notifications/tasks.py b/notifications/tasks.py index daea793e9e0..4f802285c93 100644 --- a/notifications/tasks.py +++ b/notifications/tasks.py @@ -94,7 +94,7 @@ def send_user_email_task(self, user_id, notification_ids, **kwargs): return try: - notifications_qs = Notification.objects.filter(id__in=notification_ids) + notifications_qs = Notification.objects.filter(id__in=notification_ids, sent__isnull=True) rendered_notifications, failed_notifications = safe_render_notification(notifications_qs, email_task) notifications_qs = notifications_qs.exclude(id__in=failed_notifications) @@ -168,7 +168,7 @@ def send_moderator_email_task(self, user_id, notification_ids, provider_content_ return try: - notifications_qs = Notification.objects.filter(id__in=notification_ids) + notifications_qs = Notification.objects.filter(id__in=notification_ids, sent__isnull=True) rendered_notifications, failed_notifications = safe_render_notification(notifications_qs, email_task) notifications_qs = notifications_qs.exclude(id__in=failed_notifications)