Skip to content

Commit

Permalink
Creates error modals.
Browse files Browse the repository at this point in the history
  • Loading branch information
metroid-samus committed Sep 24, 2024
1 parent a32651b commit 6fdd1a8
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/dispatch/plugins/dispatch_slack/incident/interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -1528,7 +1528,12 @@ def handle_create_task_command(
"""Displays a modal for task creation."""
ack()
if context["subject"].type == CaseSubjects.case:
raise CommandError("Command is not currently available for cases.")
modal = Modal(
title="Invalid Command",
close="Close",
blocks=[Section(text=f"Create Task command is not currently available for cases.")],
).build()
return client.views_open(trigger_id=body["trigger_id"], view=modal)

participants = participant_service.get_all_by_incident_id(
db_session=db_session, incident_id=context["subject"].id
Expand All @@ -1540,9 +1545,12 @@ def handle_create_task_command(
db_session=db_session, project_id=incident.project.id, plugin_type="contact"
)
if not contact_plugin:
raise CommandError(
"Contact plugin is not enabled. Unable to list participants.",
)
modal = Modal(
title="Plugin Not Enabled",
close="Close",
blocks=[Section(text="Contact plugin is not enabled. Unable to list participants.")],
).build()
return client.views_open(trigger_id=body["trigger_id"], view=modal)

active_participants = [p for p in participants if p.active_roles]
participant_list = []
Expand Down

0 comments on commit 6fdd1a8

Please sign in to comment.