From ecbc7d14be257a6d84b3822eb04253de878a4050 Mon Sep 17 00:00:00 2001 From: David Whittaker <84562015+whitdog47@users.noreply.github.com> Date: Tue, 3 Dec 2024 16:11:50 -0800 Subject: [PATCH] be sure to add to incident before sending ephemeral message (#5553) --- src/dispatch/task/service.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/dispatch/task/service.py b/src/dispatch/task/service.py index cb2d43b6babf..a93201ab2d65 100644 --- a/src/dispatch/task/service.py +++ b/src/dispatch/task/service.py @@ -79,6 +79,12 @@ def create(*, db_session, task_in: TaskCreate) -> Task: db_session=db_session, incident_id=incident.id, email=i.individual.email ) + assignee = incident_flows.incident_add_or_reactivate_participant_flow( + db_session=db_session, + incident_id=incident.id, + user_email=i.individual.email, + ) + if not participant or not participant.active_roles: # send emphemeral message to user about why they are being added to the incident send_task_add_ephemeral_message( @@ -88,12 +94,6 @@ def create(*, db_session, task_in: TaskCreate) -> Task: task=task_in, ) - assignee = incident_flows.incident_add_or_reactivate_participant_flow( - db_session=db_session, - incident_id=incident.id, - user_email=i.individual.email, - ) - # due to the freeform nature of task assignment, we can sometimes pick up other emails # e.g. a google group that we cannot resolve to an individual assignee if assignee: