Fix: handle null workflow body and email subject ()

This commit is contained in:
shamoon 2025-03-01 15:44:52 -08:00 committed by GitHub
parent 3cf1c04a83
commit 16f17829b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1002,7 +1002,8 @@ def run_workflows(
added = timezone.localtime(timezone.now()) added = timezone.localtime(timezone.now())
created = timezone.localtime(overrides.created) created = timezone.localtime(overrides.created)
subject = parse_w_workflow_placeholders( subject = (
parse_w_workflow_placeholders(
action.email.subject, action.email.subject,
correspondent, correspondent,
document_type, document_type,
@ -1014,7 +1015,11 @@ def run_workflows(
title, title,
doc_url, doc_url,
) )
body = parse_w_workflow_placeholders( if action.email.subject
else ""
)
body = (
parse_w_workflow_placeholders(
action.email.body, action.email.body,
correspondent, correspondent,
document_type, document_type,
@ -1026,6 +1031,9 @@ def run_workflows(
title, title,
doc_url, doc_url,
) )
if action.email.body
else ""
)
try: try:
n_messages = send_email( n_messages = send_email(
subject=subject, subject=subject,
@ -1105,7 +1113,7 @@ def run_workflows(
f"Error occurred parsing webhook params: {e}", f"Error occurred parsing webhook params: {e}",
extra={"group": logging_group}, extra={"group": logging_group},
) )
else: elif action.webhook.body:
data = parse_w_workflow_placeholders( data = parse_w_workflow_placeholders(
action.webhook.body, action.webhook.body,
correspondent, correspondent,