Skip to content
This repository was archived by the owner on Sep 3, 2025. It is now read-only.

Commit 5be5560

Browse files
authored
Deprecates dispatch-list-resources command in favor of Slack channel bookmarks (#2946)
1 parent 867679f commit 5be5560

File tree

9 files changed

+7
-168
lines changed

9 files changed

+7
-168
lines changed

docs/admin-guide/administration/plugins/configuring-slack.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ You can override their values if you wish to do so. Included below are their des
164164
| `/dispatch-list-incidents <organization-slug\|'default'> <project-slug\|'default'>` | Lists current active and stable incidents and closed incidents in the last 24 hours. |
165165
| `/dispatch-list-my-tasks` | Opens a modal with the list of your open and resolved incident tasks. |
166166
| `/dispatch-list-participants` | Opens a modal with the list of incident participants. |
167-
| `/dispatch-list-resources` | Opens a modal with the list of all incident resources. |
168167
| `/dispatch-list-tasks` | Opens a modal with the list of open and resolved incident tasks. |
169168
| `/dispatch-list-workflows` | List workflows previously run during this incident. |
170169
| `/dispatch-report-executive` | Opens a modal to write an executive report. |

docs/user-guide/incident-commander.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ All Slack commands are listed below, or you may view _groups_ of commands relati
1717
- [`/dispatch-engage-oncall`](#%2Fdispatch-engage-oncall)
1818
- [`/dispatch-list-my-tasks`](#%2Fdispatch-list-my-tasks)
1919
- [`/dispatch-list-participants`](#%2Fdispatch-list-participants)
20-
- [`/dispatch-list-resources`](#%2Fdispatch-list-resources)
2120
- [`/dispatch-list-tasks`](#%2Fdispatch-list-tasks)
2221
- [`/dispatch-list-workflows`](#%2Fdispatch-list-workflows)
2322
- [`/dispatch-list-incidents`](#%2Fdispatch-list-incidents)

src/dispatch/conversation/enums.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ class ConversationCommands(DispatchEnum):
77
engage_oncall = "engage-oncall"
88
executive_report = "executive-report"
99
list_participants = "list-participants"
10-
list_resources = "list-resources"
1110
list_tasks = "list-tasks"
1211
report_incident = "report-incident"
1312
tactical_report = "tactical-report"

src/dispatch/incident/messaging.py

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
INCIDENT_PARTICIPANT_SUGGESTED_READING_ITEM,
3131
INCIDENT_PARTICIPANT_WELCOME_MESSAGE,
3232
INCIDENT_PRIORITY_CHANGE,
33-
INCIDENT_RESOURCES_MESSAGE,
3433
INCIDENT_REVIEW_DOCUMENT,
3534
INCIDENT_SEVERITY_CHANGE,
3635
INCIDENT_STATUS_CHANGE,
@@ -724,71 +723,6 @@ def send_incident_review_document_notification(
724723
log.debug("Incident review document notification sent.")
725724

726725

727-
def send_incident_resources_ephemeral_message_to_participant(
728-
user_id: str, incident: Incident, db_session: SessionLocal
729-
):
730-
"""Sends the list of incident resources to the participant via an ephemeral message."""
731-
plugin = plugin_service.get_active_instance(
732-
db_session=db_session, project_id=incident.project.id, plugin_type="conversation"
733-
)
734-
if not plugin:
735-
log.warning("Incident resource message not sent, no conversation plugin enabled.")
736-
return
737-
738-
incident_description = (
739-
incident.description
740-
if len(incident.description) <= 500
741-
else f"{incident.description[:500]}..."
742-
)
743-
744-
message_kwargs = {
745-
"title": incident.title,
746-
"description": incident_description,
747-
"commander_fullname": incident.commander.individual.name,
748-
"commander_team": incident.commander.team,
749-
"commander_weblink": incident.commander.individual.weblink,
750-
"reporter_fullname": incident.reporter.individual.name,
751-
"reporter_team": incident.reporter.team,
752-
"reporter_weblink": incident.reporter.individual.weblink,
753-
"document_weblink": resolve_attr(incident, "incident_document.weblink"),
754-
"storage_weblink": resolve_attr(incident, "storage.weblink"),
755-
"ticket_weblink": resolve_attr(incident, "ticket.weblink"),
756-
"conference_weblink": resolve_attr(incident, "conference.weblink"),
757-
"conference_challenge": resolve_attr(incident, "conference.conference_challenge"),
758-
}
759-
760-
if incident.incident_review_document:
761-
message_kwargs.update(
762-
{"review_document_weblink": incident.incident_review_document.weblink}
763-
)
764-
765-
faq_doc = document_service.get_incident_faq_document(
766-
db_session=db_session, project_id=incident.project_id
767-
)
768-
if faq_doc:
769-
message_kwargs.update({"faq_weblink": faq_doc.weblink})
770-
771-
conversation_reference = document_service.get_conversation_reference_document(
772-
db_session=db_session, project_id=incident.project_id
773-
)
774-
if conversation_reference:
775-
message_kwargs.update(
776-
{"conversation_commands_reference_document_weblink": conversation_reference.weblink}
777-
)
778-
779-
# we send the ephemeral message
780-
plugin.instance.send_ephemeral(
781-
incident.conversation.channel_id,
782-
user_id,
783-
"Incident Resources Message",
784-
INCIDENT_RESOURCES_MESSAGE,
785-
MessageType.incident_resources_message,
786-
**message_kwargs,
787-
)
788-
789-
log.debug(f"List of incident resources sent to {user_id} via ephemeral message.")
790-
791-
792726
def send_incident_close_reminder(incident: Incident, db_session: SessionLocal):
793727
"""
794728
Sends a direct message to the incident commander reminding

src/dispatch/messaging/strings.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
from dispatch.conversation.enums import ConversationButtonActions
88
from dispatch.incident.enums import IncidentStatus
9-
from dispatch.case.enums import CaseStatus
109

1110
from dispatch.enums import DispatchEnum, DocumentResourceTypes, DocumentResourceReferenceTypes
1211

@@ -23,7 +22,6 @@ class MessageType(DispatchEnum):
2322
incident_participant_suggested_reading = "incident-participant-suggested-reading"
2423
incident_participant_welcome = "incident-participant-welcome"
2524
incident_rating_feedback = "incident-rating-feedback"
26-
incident_resources_message = "incident-resources-message"
2725
incident_status_reminder = "incident-status-reminder"
2826
incident_tactical_report = "incident-tactical-report"
2927
incident_task_list = "incident-task-list"
@@ -299,7 +297,7 @@ class MessageType(DispatchEnum):
299297
\n • Keep the incident and its status up to date using the Slack `{{update_command}}` command.
300298
\n • Invite incident participants and team oncalls by mentioning them in the incident channel or using the Slack `{{engage_oncall_command}}` command.
301299
\n • Keep incident participants and stakeholders informed by creating tactical and executive reports using the `{{tactical_report_command}}` and `{{executive_report_command}}` commands.
302-
\n • Get links to all incident resources including the Slack commands reference sheet and Security Incident Response FAQ by running the `{{list_resources_command}}` command.
300+
\n • Get links to incident resources from the <{{dispatch_ui_incident_url}}|Dispatch Web UI> or bookmarks in the incident conversation.
303301
\n
304302
To find a Slack command, simply type `/` in the message field or click the lightning bolt icon to the left of the message field.
305303
"""
@@ -490,19 +488,6 @@ class MessageType(DispatchEnum):
490488
INCIDENT_FAQ_DOCUMENT,
491489
]
492490

493-
INCIDENT_RESOURCES_MESSAGE = [
494-
INCIDENT_TITLE,
495-
INCIDENT_DESCRIPTION,
496-
INCIDENT_REPORTER,
497-
INCIDENT_COMMANDER,
498-
INCIDENT_INVESTIGATION_DOCUMENT,
499-
INCIDENT_REVIEW_DOCUMENT,
500-
INCIDENT_STORAGE,
501-
INCIDENT_CONFERENCE,
502-
INCIDENT_CONVERSATION_COMMANDS_REFERENCE_DOCUMENT,
503-
INCIDENT_FAQ_DOCUMENT,
504-
]
505-
506491
INCIDENT_NOTIFICATION_COMMON = [INCIDENT_TITLE]
507492

508493
INCIDENT_NOTIFICATION = INCIDENT_NOTIFICATION_COMMON.copy()

src/dispatch/plugins/dispatch_slack/config.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,6 @@ class SlackConversationConfiguration(SlackConfiguration):
9393
title="Engage Oncall Command String",
9494
description="Defines the string used to engage an oncall. Must match what is defined in Slack.",
9595
)
96-
slack_command_list_resources: str = Field(
97-
"/dispatch-list-resources",
98-
title="List Resources Command String",
99-
description="Defines the string used to list incident resources. Must match what is defined in Slack.",
100-
)
10196
slack_command_report_incident: str = Field(
10297
"/dispatch-report-incident",
10398
title="Report Incident Command String",

src/dispatch/plugins/dispatch_slack/incident/interactive.py

Lines changed: 5 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import logging
21
from datetime import datetime
32
from typing import Any
4-
3+
import logging
54
import pytz
5+
66
from blockkit import (
77
Actions,
88
Button,
@@ -22,16 +22,13 @@
2222
from slack_bolt import Ack, BoltContext, BoltRequest, Respond
2323
from slack_sdk.errors import SlackApiError
2424
from slack_sdk.web.client import WebClient
25+
2526
from sqlalchemy import func
2627
from sqlalchemy.orm import Session
2728

2829
from dispatch.auth.models import DispatchUser
2930
from dispatch.config import DISPATCH_UI_URL
30-
31-
# from dispatch.database.core import resolve_attr
3231
from dispatch.database.service import search_filter_sort_paginate
33-
34-
# from dispatch.document import service as document_service
3532
from dispatch.enums import Visibility
3633
from dispatch.event import service as event_service
3734
from dispatch.exceptions import DispatchException
@@ -41,8 +38,6 @@
4138
from dispatch.incident.models import IncidentCreate, IncidentRead, IncidentUpdate
4239
from dispatch.individual import service as individual_service
4340
from dispatch.individual.models import IndividualContactRead
44-
45-
# from dispatch.messaging.strings import INCIDENT_RESOURCES_MESSAGE, MessageType
4641
from dispatch.monitor import service as monitor_service
4742
from dispatch.monitor.models import MonitorCreate
4843
from dispatch.nlp import build_phrase_matcher, build_term_vocab, extract_terms_from_text
@@ -55,6 +50,8 @@
5550
from dispatch.plugins.dispatch_slack.bolt import app
5651
from dispatch.plugins.dispatch_slack.decorators import message_dispatcher
5752
from dispatch.plugins.dispatch_slack.exceptions import CommandError
53+
from dispatch.plugins.dispatch_slack.models import MonitorMetadata, TaskMetadata
54+
from dispatch.plugins.dispatch_slack.service import get_user_email, get_user_profile_by_email
5855
from dispatch.plugins.dispatch_slack.fields import (
5956
DefaultActionIds,
6057
DefaultBlockIds,
@@ -96,8 +93,6 @@
9693
UpdateParticipantActions,
9794
UpdateParticipantBlockIds,
9895
)
99-
100-
# from dispatch.plugins.dispatch_slack.messaging import create_message_blocks
10196
from dispatch.plugins.dispatch_slack.middleware import (
10297
action_context_middleware,
10398
button_context_middleware,
@@ -112,8 +107,6 @@
112107
subject_middleware,
113108
user_middleware,
114109
)
115-
from dispatch.plugins.dispatch_slack.models import MonitorMetadata, TaskMetadata
116-
from dispatch.plugins.dispatch_slack.service import get_user_email, get_user_profile_by_email
117110
from dispatch.project import service as project_service
118111
from dispatch.report import flows as report_flows
119112
from dispatch.report import service as report_service
@@ -151,10 +144,6 @@ def configure(config):
151144
command_context_middleware,
152145
]
153146

154-
app.command(config.slack_command_list_resources, middleware=middleware)(
155-
handle_list_resources_command
156-
)
157-
158147
middleware = [
159148
subject_middleware,
160149
configuration_middleware,
@@ -638,62 +627,6 @@ def draw_task_modal(
638627
client.views_update(view_id=view_id, view=modal)
639628

640629

641-
# NOTE: This command has been deprecated in favor of channel bookmarks and its code will be removed in Q1 2023.
642-
def handle_list_resources_command(
643-
ack: Ack, db_session: Session, context: BoltContext, respond: Respond
644-
) -> None:
645-
"""Handles the list resources command."""
646-
ack()
647-
648-
# incident = incident_service.get(db_session=db_session, incident_id=context["subject"].id)
649-
#
650-
# incident_description = (
651-
# incident.description
652-
# if len(incident.description) <= 500
653-
# else f"{incident.description[:500]}..."
654-
# )
655-
#
656-
# # we send the ephemeral message
657-
# message_kwargs = {
658-
# "title": incident.title,
659-
# "description": incident_description,
660-
# "commander_fullname": incident.commander.individual.name,
661-
# "commander_team": incident.commander.team,
662-
# "commander_weblink": incident.commander.individual.weblink,
663-
# "reporter_fullname": incident.reporter.individual.name,
664-
# "reporter_team": incident.reporter.team,
665-
# "reporter_weblink": incident.reporter.individual.weblink,
666-
# "document_weblink": resolve_attr(incident, "incident_document.weblink"),
667-
# "storage_weblink": resolve_attr(incident, "storage.weblink"),
668-
# "conference_weblink": resolve_attr(incident, "conference.weblink"),
669-
# "conference_challenge": resolve_attr(incident, "conference.conference_challenge"),
670-
# }
671-
#
672-
# faq_doc = document_service.get_incident_faq_document(
673-
# db_session=db_session, project_id=incident.project_id
674-
# )
675-
# if faq_doc:
676-
# message_kwargs.update({"faq_weblink": faq_doc.weblink})
677-
#
678-
# conversation_reference = document_service.get_conversation_reference_document(
679-
# db_session=db_session, project_id=incident.project_id
680-
# )
681-
# if conversation_reference:
682-
# message_kwargs.update(
683-
# {"conversation_commands_reference_document_weblink": conversation_reference.weblink}
684-
# )
685-
#
686-
# blocks = create_message_blocks(
687-
# INCIDENT_RESOURCES_MESSAGE, MessageType.incident_resources_message, **message_kwargs
688-
# )
689-
#
690-
# blocks = Message(blocks=blocks).build()["blocks"]
691-
# respond(text="Incident Resources", blocks=blocks, response_type="ephemeral")
692-
693-
message = "This slash command has been deprecated in favor of channel bookmarks. You can find all incident resources bookmarked in the channel."
694-
respond(text=message, response_type="ephemeral", replace_original=False, delete_original=False)
695-
696-
697630
# EVENTS
698631

699632

src/dispatch/plugins/dispatch_slack/messaging.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,6 @@ def get_incident_conversation_command_message(
9595
"response_type": "ephemeral",
9696
"text": "Opening a dialog to engage an oncall person...",
9797
},
98-
config.slack_command_list_resources: {
99-
"response_type": "ephemeral",
100-
"text": "Fetching the list of incident resources...",
101-
},
10298
config.slack_command_report_incident: {
10399
"response_type": "ephemeral",
104100
"text": "Opening a dialog to report an incident...",

src/dispatch/plugins/dispatch_slack/plugin.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
)
2727

2828
from .case.messages import create_case_message, create_signal_messages
29-
from .endpoints import router as slack_event_router
3029

30+
from .endpoints import router as slack_event_router
3131
from .messaging import create_message_blocks
3232
from .service import (
3333
add_users_to_conversation_thread,
@@ -232,7 +232,6 @@ def get_command_name(self, command: str):
232232
ConversationCommands.engage_oncall: self.configuration.slack_command_engage_oncall,
233233
ConversationCommands.executive_report: self.configuration.slack_command_report_executive,
234234
ConversationCommands.list_participants: self.configuration.slack_command_list_participants,
235-
ConversationCommands.list_resources: self.configuration.slack_command_list_resources,
236235
ConversationCommands.list_tasks: self.configuration.slack_command_list_tasks,
237236
ConversationCommands.tactical_report: self.configuration.slack_command_report_tactical,
238237
}

0 commit comments

Comments
 (0)