|
15 | 15 | from apps.slack.constants import DIVIDER, PRIVATE_METADATA_MAX_LENGTH
|
16 | 16 | from apps.slack.errors import SlackAPIChannelNotFoundError
|
17 | 17 | from apps.slack.scenarios import scenario_step
|
| 18 | +from apps.slack.slash_command import SlashCommand |
18 | 19 | from apps.slack.types import (
|
19 | 20 | Block,
|
20 | 21 | BlockActionType,
|
@@ -115,7 +116,13 @@ def get_current_items(
|
115 | 116 | class StartDirectPaging(scenario_step.ScenarioStep):
|
116 | 117 | """Handle slash command invocation and show initial dialog."""
|
117 | 118 |
|
118 |
| - command_name = [settings.SLACK_DIRECT_PAGING_SLASH_COMMAND] |
| 119 | + @staticmethod |
| 120 | + def matcher(slash_command: SlashCommand) -> bool: |
| 121 | + # Check if command is /escalate. It's a legacy command we keep for smooth transition. |
| 122 | + is_legacy_command = slash_command.command == settings.SLACK_DIRECT_PAGING_SLASH_COMMAND |
| 123 | + # Check if command is /grafana escalate. It's a new command from unified app. |
| 124 | + is_unified_app_command = slash_command.is_grafana_command and slash_command.subcommand == "escalate" |
| 125 | + return is_legacy_command or is_unified_app_command |
119 | 126 |
|
120 | 127 | def process_scenario(
|
121 | 128 | self,
|
@@ -995,8 +1002,8 @@ def _generate_input_id_prefix() -> str:
|
995 | 1002 | },
|
996 | 1003 | {
|
997 | 1004 | "payload_type": PayloadType.SLASH_COMMAND,
|
998 |
| - "command_name": StartDirectPaging.command_name, |
999 | 1005 | "step": StartDirectPaging,
|
| 1006 | + "matcher": StartDirectPaging.matcher, |
1000 | 1007 | },
|
1001 | 1008 | {
|
1002 | 1009 | "payload_type": PayloadType.VIEW_SUBMISSION,
|
|
0 commit comments