better reader for mails
This commit is contained in:
Binary file not shown.
@@ -20,10 +20,13 @@ def generate_mail_from_notification(notif: Notif) -> Optional[Mail]:
|
||||
"""
|
||||
logger.debug(f"Generating mail for notification: {notif}")
|
||||
|
||||
# Convert notification type to template name format (e.g., 'account_created' -> 'Account Created')
|
||||
template_name = ' '.join(word.capitalize() for word in notif.notif_type.split('_'))
|
||||
|
||||
# Find the corresponding email template based on notif_type
|
||||
template = EmailTemplate.query.filter_by(name=notif.notif_type).first()
|
||||
template = EmailTemplate.query.filter_by(name=template_name).first()
|
||||
if not template:
|
||||
logger.warning(f"No email template found for notification type: {notif.notif_type}")
|
||||
logger.warning(f"No email template found for notification type: {notif.notif_type} (template name: {template_name})")
|
||||
return None
|
||||
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user