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

Creates the modal immediately after invocation. Update the modal with the task fields after. #5276

Merged
merged 2 commits into from
Oct 1, 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
15 changes: 11 additions & 4 deletions src/dispatch/plugins/dispatch_slack/incident/interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -1586,20 +1586,27 @@ def handle_assign_role_submission_event(
def handle_create_task_command(
ack: Ack,
body,
dict,
client: WebClient,
context: BoltContext,
db_session: Session,
) -> None:
"""Displays a modal for task creation."""
ack()

initial_modal = Modal(
title="Create Task",
close="Close",
blocks=[Section(text="Opening a dialog to create a new incident task...")],
).build()
response = client.views_open(trigger_id=body["trigger_id"], view=initial_modal)

if context["subject"].type == CaseSubjects.case:
modal = Modal(
title="Invalid Command",
close="Close",
blocks=[Section(text="Create Task command is not currently available for cases.")],
).build()
return client.views_open(trigger_id=body["trigger_id"], view=modal)
return client.views_update(view_id=response.get("view").get("id"), view=modal)

participants = participant_service.get_all_by_incident_id(
db_session=db_session, incident_id=context["subject"].id
Expand All @@ -1616,7 +1623,7 @@ def handle_create_task_command(
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)
return client.views_update(view_id=response.get("view").get("id"), view=modal)

active_participants = [p for p in participants if p.active_roles]
participant_list = []
Expand Down Expand Up @@ -1649,7 +1656,7 @@ def handle_create_task_command(
callback_id=CreateTaskActionIds.submit,
private_metadata=context["subject"].json(),
).build()
client.views_open(trigger_id=body["trigger_id"], view=modal)
return client.views_update(view_id=response.get("view").get("id"), view=modal)


def ack_create_task_submission_event(ack: Ack) -> None:
Expand Down
Loading