From 85d75e3422de06a017c9a97f45a3053ec172c064 Mon Sep 17 00:00:00 2001 From: David Whittaker Date: Wed, 28 May 2025 16:15:48 -0700 Subject: [PATCH] fix(cases): use separate email template for cases --- src/dispatch/case/flows.py | 8 +++++--- src/dispatch/email_templates/enums.py | 3 ++- src/dispatch/incident/messaging.py | 2 +- .../static/dispatch/src/email_templates/NewEditSheet.vue | 6 +++--- tests/factories.py | 2 +- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/dispatch/case/flows.py b/src/dispatch/case/flows.py index e33b838cc9ca..3096f4410267 100644 --- a/src/dispatch/case/flows.py +++ b/src/dispatch/case/flows.py @@ -138,7 +138,7 @@ def case_add_or_reactivate_participant_flow( welcome_template = email_template_service.get_by_type( db_session=db_session, project_id=case.project_id, - email_template_type=EmailTemplateTypes.welcome, + email_template_type=EmailTemplateTypes.case_welcome, ) send_case_welcome_participant_message( @@ -303,7 +303,9 @@ def case_new_create_flow( ) oncall_name = oncall_service.name except Exception as e: - log.error(f"Failed to get oncall service: {e}. Falling back to default oncall_name string.") + log.error( + f"Failed to get oncall service: {e}. Falling back to default oncall_name string." + ) send_event_paging_message(case, db_session, oncall_name) @@ -1073,7 +1075,7 @@ def case_create_resources_flow( welcome_template = email_template_service.get_by_type( db_session=db_session, project_id=case.project_id, - email_template_type=EmailTemplateTypes.welcome, + email_template_type=EmailTemplateTypes.case_welcome, ) for user_email in set(individual_participants): diff --git a/src/dispatch/email_templates/enums.py b/src/dispatch/email_templates/enums.py index 16ad719a9612..888cd08fe38f 100644 --- a/src/dispatch/email_templates/enums.py +++ b/src/dispatch/email_templates/enums.py @@ -2,4 +2,5 @@ class EmailTemplateTypes(DispatchEnum): - welcome = "Incident Welcome Email" + case_welcome = "Case Welcome Email" + incident_welcome = "Incident Welcome Email" diff --git a/src/dispatch/incident/messaging.py b/src/dispatch/incident/messaging.py index c6f4c2b541de..7fa74e3873ee 100644 --- a/src/dispatch/incident/messaging.py +++ b/src/dispatch/incident/messaging.py @@ -296,7 +296,7 @@ def send_incident_welcome_participant_messages( welcome_template = email_template_service.get_by_type( db_session=db_session, project_id=incident.project_id, - email_template_type=EmailTemplateTypes.welcome, + email_template_type=EmailTemplateTypes.incident_welcome, ) # we send the welcome ephemeral message diff --git a/src/dispatch/static/dispatch/src/email_templates/NewEditSheet.vue b/src/dispatch/static/dispatch/src/email_templates/NewEditSheet.vue index 883a1522c408..0e6b534ceb9e 100644 --- a/src/dispatch/static/dispatch/src/email_templates/NewEditSheet.vue +++ b/src/dispatch/static/dispatch/src/email_templates/NewEditSheet.vue @@ -34,7 +34,7 @@ @@ -55,7 +55,7 @@ diff --git a/tests/factories.py b/tests/factories.py index 9797bffa889b..ebbe9447f82c 100644 --- a/tests/factories.py +++ b/tests/factories.py @@ -1256,7 +1256,7 @@ class EmailTemplateFactory(BaseFactory): """Email Template Factory.""" # Columns - email_template_type = EmailTemplateTypes.welcome + email_template_type = EmailTemplateTypes.incident_welcome welcome_text = "Welcome to Incident {{title}} " welcome_body = "{{title}} Incident\n{{description}}" components = ["title", "description"]