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

Enhances Slack Case Handling and Messaging for Improved Clarity and User Interaction #5267

Merged
merged 9 commits into from
Oct 1, 2024
16 changes: 5 additions & 11 deletions src/dispatch/plugins/dispatch_slack/case/interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -2293,20 +2293,20 @@ def send_engagement_response(
if response == MfaChallengeStatus.APPROVED:
title = "Approve"
text = "Confirmation... Success!"
message_text = f":white_check_mark: {engaged_user} confirmed the behavior *is expected*.\n\n *Context Provided* \n```{context_from_user}```"
message_text = f":white_check_mark: {engaged_user} confirmed the behavior as expected.\n\n *Context Provided* \n```{context_from_user}```"
engagement_status = SignalEngagementStatus.approved
else:
title = "MFA Failed"
engagement_status = SignalEngagementStatus.denied

if response == MfaChallengeStatus.EXPIRED:
text = "Confirmation failed, the MFA request timed out. Please have your MFA device ready to accept the push notification and try again."
text = "Confirmation failed, the MFA request timed out. Please, have your MFA device ready to accept the push notification and try again."
elif response == MfaChallengeStatus.DENIED:
text = "User not found in MFA provider. To validate your identity, please register in Duo and try again."
text = f"User {engaged_user} not found in MFA provider. To validate your identity, please register in Duo and try again."
else:
text = "Confirmation failed. You must accept the MFA prompt."

message_text = f":warning: {engaged_user} attempted to confirm the behavior *as expected*, but the MFA validation failed.\n\n **Error Reason**: `{response}`\n\n{text}\n\n *Context Provided* \n```{context_from_user}```\n\n"
message_text = f":warning: {engaged_user} attempted to confirm the behavior as expected, but we ran into an error during MFA validation (`{response}`)\n\n{text}\n\n *Context Provided* \n```{context_from_user}```\n\n"

send_success_modal(
client=client,
Expand Down Expand Up @@ -2365,7 +2365,7 @@ def resolve_case(
case_in = CaseUpdate(
title=case.title,
resolution_reason=CaseResolutionReason.user_acknowledge,
resolution=f"Case resolved through user engagement. User context: {context_from_user}",
resolution=context_from_user,
visibility=case.visibility,
status=CaseStatus.closed,
closed_at=datetime.utcnow(),
Expand All @@ -2385,12 +2385,6 @@ def resolve_case(
client.chat_update(
blocks=blocks, ts=case.conversation.thread_id, channel=case.conversation.channel_id
)
client.chat_postMessage(
text="Case has been resolved.",
channel=case.conversation.channel_id,
thread_ts=case.conversation.thread_id,
)


@app.action(
SignalEngagementActions.deny,
Expand Down
Loading
Loading