# HG changeset patch # User Andrii Verbytskyi # Date 2024-10-07 08:27:32 # Node ID d9b3c62351e7e44eaddfdf768f23982da8a34bbe # Parent 8026ecb9e90a8628e10ef9c34c1deff101735ea6 fix: do not render email if we arent sending email with notification diff --git a/rhodecode/model/notification.py b/rhodecode/model/notification.py --- a/rhodecode/model/notification.py +++ b/rhodecode/model/notification.py @@ -117,14 +117,16 @@ class NotificationModel(BaseModel): # add mentioned users into recipients final_recipients = set(recipients_objs).union(mention_recipients) - (subject, email_body, email_body_plaintext) = \ - EmailNotificationModel().render_email(notification_type, **email_kwargs) + # No need to render email if we are sending just notification + if with_email: + (subject, email_body, email_body_plaintext) = \ + EmailNotificationModel().render_email(notification_type, **email_kwargs) - if not notification_subject: - notification_subject = subject + if not notification_subject: + notification_subject = subject - if not notification_body: - notification_body = email_body_plaintext + if not notification_body: + notification_body = email_body_plaintext notification = Notification.create( created_by=created_by_obj, subject=notification_subject,