fix: do not render email if we arent sending email with notification

This commit is contained in:
Andrii Verbytskyi 2024-10-07 10:27:32 +02:00
parent d59469e975
commit a743a8136b

View file

@ -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,