mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-16 01:31:09 -06:00
Move email backend check to execute_email_action for consistency
This commit is contained in:
@@ -731,13 +731,6 @@ def run_workflows(
|
|||||||
else:
|
else:
|
||||||
apply_removal_to_document(action, document, doc_tag_ids)
|
apply_removal_to_document(action, document, doc_tag_ids)
|
||||||
elif action.type == WorkflowAction.WorkflowActionType.EMAIL:
|
elif action.type == WorkflowAction.WorkflowActionType.EMAIL:
|
||||||
if not settings.EMAIL_ENABLED:
|
|
||||||
logger.error(
|
|
||||||
"Email backend has not been configured, cannot send email notifications",
|
|
||||||
extra={"group": logging_group},
|
|
||||||
)
|
|
||||||
continue
|
|
||||||
|
|
||||||
context = build_workflow_action_context(document, overrides)
|
context = build_workflow_action_context(document, overrides)
|
||||||
execute_email_action(
|
execute_email_action(
|
||||||
action,
|
action,
|
||||||
|
|||||||
@@ -3096,7 +3096,7 @@ class TestWorkflows(
|
|||||||
original_filename="sample.pdf",
|
original_filename="sample.pdf",
|
||||||
)
|
)
|
||||||
|
|
||||||
with self.assertLogs("paperless.handlers", level="ERROR") as cm:
|
with self.assertLogs("paperless.workflows.actions", level="ERROR") as cm:
|
||||||
run_workflows(WorkflowTrigger.WorkflowTriggerType.DOCUMENT_UPDATED, doc)
|
run_workflows(WorkflowTrigger.WorkflowTriggerType.DOCUMENT_UPDATED, doc)
|
||||||
|
|
||||||
expected_str = "Email backend has not been configured"
|
expected_str = "Email backend has not been configured"
|
||||||
|
|||||||
@@ -90,6 +90,13 @@ def execute_email_action(
|
|||||||
Execute an email action for a workflow.
|
Execute an email action for a workflow.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if not settings.EMAIL_ENABLED:
|
||||||
|
logger.error(
|
||||||
|
"Email backend has not been configured, cannot send email notifications",
|
||||||
|
extra={"group": logging_group},
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
subject = (
|
subject = (
|
||||||
parse_w_workflow_placeholders(
|
parse_w_workflow_placeholders(
|
||||||
action.email.subject,
|
action.email.subject,
|
||||||
|
|||||||
Reference in New Issue
Block a user