Avoid adding the same notification twice to a sender

This commit is contained in:
Daniel Schick 2025-03-06 09:51:12 +01:00
parent c8550431e0
commit 27b9f46f30

View File

@ -220,7 +220,8 @@ def SendNotifications():
if user["notify_email"]: if user["notify_email"]:
if user["user_email"] not in email_dict: if user["user_email"] not in email_dict:
email_dict[user["user_email"]] = [] email_dict[user["user_email"]] = []
email_dict[user["user_email"]].append(notification) if notification not in email_dict[user["user_email"]]:
email_dict[user["user_email"]].append(notification)
if user["notify_whatsapp"]: if user["notify_whatsapp"]:
# TBD # TBD
pass pass
@ -236,7 +237,8 @@ def SendNotifications():
if user["notify_email"] and notification.type in user_notifications: if user["notify_email"] and notification.type in user_notifications:
if user["user_email"] not in email_dict: if user["user_email"] not in email_dict:
email_dict[user["user_email"]] = [] email_dict[user["user_email"]] = []
email_dict[user["user_email"]].append(notification) if notification not in email_dict[user["user_email"]]:
email_dict[user["user_email"]].append(notification)
if user["notify_whatsapp"] and notification.type in user_notifications: if user["notify_whatsapp"] and notification.type in user_notifications:
# TBD # TBD
pass pass