Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for incident member before re-adding #4863

Merged
merged 1 commit into from
Jun 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 24 additions & 18 deletions src/dispatch/case/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,28 +646,34 @@ def common_escalate_flow(

# we add the case participants to the incident
for participant in case.participants:
log.info(
f"Adding participant {participant.individual.email} from Case {case.id} to Incident {incident.id}"
# check to see if already a participant in the incident
incident_participant = participant_service.get_by_incident_id_and_email(
db_session=db_session, incident_id=incident.id, email=participant.individual.email
)
# Get the roles for this participant
case_roles = participant.participant_roles

# Map the case role to an incident role
incident_role = ParticipantRoleType.map_case_role_to_incident_role(case_roles)
if not incident_participant:
log.info(
f"Adding participant {participant.individual.email} from Case {case.id} to Incident {incident.id}"
)
# Get the roles for this participant
case_roles = participant.participant_roles

participant_flows.add_participant(
participant.individual.email,
incident,
db_session,
role=incident_role,
)
# Map the case role to an incident role
incident_role = ParticipantRoleType.map_case_role_to_incident_role(case_roles)

# We add the participants to the conversation
conversation_flows.add_incident_participants_to_conversation(
db_session=db_session,
incident=incident,
participant_emails=[participant.individual.email],
)
participant_flows.add_participant(
participant.individual.email,
incident,
db_session,
role=incident_role,
)

# We add the participants to the conversation
conversation_flows.add_incident_participants_to_conversation(
db_session=db_session,
incident=incident,
participant_emails=[participant.individual.email],
)

if case.has_channel:
# depends on `incident_create_flow()` (we need incident.name), so we invoke after we call it
Expand Down
Loading