Skip to content

Commit

Permalink
Resolving a case thread should update the other case resources. (#4937)
Browse files Browse the repository at this point in the history
  • Loading branch information
metroid-samus authored Jul 9, 2024
1 parent b00b5b2 commit bf11339
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/dispatch/plugins/dispatch_slack/case/interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -1514,6 +1514,7 @@ def handle_resolve_submission_event(
ack()
# we get the current or previous case
case = case_service.get(db_session=db_session, case_id=context["subject"].id)
previous_case = CaseRead.from_orm(case)

# we run the case status transition flow
case_flows.case_status_transition_flow_dispatcher(
Expand All @@ -1539,6 +1540,15 @@ def handle_resolve_submission_event(
current_user=user,
)

case_flows.case_update_flow(
case_id=case.id,
previous_case=previous_case,
db_session=db_session,
reporter_email=case.reporter.individual.email if case.reporter else None,
assignee_email=case.assignee.individual.email if case.assignee else None,
organization_slug=context["subject"].organization_slug,
)

# We update the case message with the new resolution and status
blocks = create_case_message(case=case, channel_id=context["subject"].channel_id)
client.chat_update(
Expand Down Expand Up @@ -1996,6 +2006,7 @@ def resolve_case(
context_from_user: str,
user: DispatchUser,
) -> None:
previous_case = CaseRead.from_orm(case)
case_flows.case_status_transition_flow_dispatcher(
case=case,
current_status=CaseStatus.closed,
Expand All @@ -2013,6 +2024,15 @@ def resolve_case(
)
case = case_service.update(db_session=db_session, case=case, case_in=case_in, current_user=user)

case_flows.case_update_flow(
case_id=case.id,
previous_case=previous_case,
db_session=db_session,
reporter_email=case.reporter.individual.email if case.reporter else None,
assignee_email=case.assignee.individual.email if case.assignee else None,
organization_slug=case.project.organization.slug,
)

blocks = create_case_message(case=case, channel_id=channel_id)
client.chat_update(
blocks=blocks, ts=case.conversation.thread_id, channel=case.conversation.channel_id
Expand Down

0 comments on commit bf11339

Please sign in to comment.