From 1f148f1276458f0c754d833e4c58c8d87032c074 Mon Sep 17 00:00:00 2001 From: Marc Vilanova <39573146+mvilanova@users.noreply.github.com> Date: Thu, 14 Nov 2024 16:05:40 -0800 Subject: [PATCH] feat(slack plugin): improve user experience when resolving cases via Slack (#5485) --- .../dispatch_slack/case/interactive.py | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/dispatch/plugins/dispatch_slack/case/interactive.py b/src/dispatch/plugins/dispatch_slack/case/interactive.py index 89b9c2bf7e9f..0e87c13a0fce 100644 --- a/src/dispatch/plugins/dispatch_slack/case/interactive.py +++ b/src/dispatch/plugins/dispatch_slack/case/interactive.py @@ -1892,16 +1892,6 @@ def handle_resolve_submission_event( current_user=user, ) - # we run the case update flow - case_flows.case_update_flow( - case_id=updated_case.id, - previous_case=previous_case, - db_session=db_session, - reporter_email=updated_case.reporter.individual.email if updated_case.reporter else None, - assignee_email=updated_case.assignee.individual.email if updated_case.assignee else None, - organization_slug=context["subject"].organization_slug, - ) - # we update the case notification with the resolution, resolution reason and status blocks = create_case_message(case=updated_case, channel_id=context["subject"].channel_id) client.chat_update( @@ -1910,6 +1900,23 @@ def handle_resolve_submission_event( channel=updated_case.conversation.channel_id, ) + try: + # we run the case update flow + case_flows.case_update_flow( + case_id=updated_case.id, + previous_case=previous_case, + db_session=db_session, + reporter_email=updated_case.reporter.individual.email + if updated_case.reporter + else None, + assignee_email=updated_case.assignee.individual.email + if updated_case.assignee + else None, + organization_slug=context["subject"].organization_slug, + ) + except Exception as e: + log.error(f"Error running case update flow from Slack plugin: {e}") + @app.shortcut(CaseShortcutCallbacks.report, middleware=[db_middleware, shortcut_context_middleware]) def report_issue(