mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-10 13:11:20 +00:00
Move email backend check to execute_email_action for consistency
This commit is contained in:
@@ -731,13 +731,6 @@ def run_workflows(
|
||||
else:
|
||||
apply_removal_to_document(action, document, doc_tag_ids)
|
||||
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)
|
||||
execute_email_action(
|
||||
action,
|
||||
|
||||
@@ -3096,7 +3096,7 @@ class TestWorkflows(
|
||||
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)
|
||||
|
||||
expected_str = "Email backend has not been configured"
|
||||
|
||||
@@ -90,6 +90,13 @@ def execute_email_action(
|
||||
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 = (
|
||||
parse_w_workflow_placeholders(
|
||||
action.email.subject,
|
||||
|
||||
Reference in New Issue
Block a user