Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion src/firetower/slack_app/bolt.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"sev",
"setseverity",
"subject",
"title",
"update",
"edit",
"captain",
Expand Down Expand Up @@ -123,7 +124,7 @@ def handle_command(
handle_severity_command(ack, body, command, respond, new_severity=args)
elif subcommand in ("update", "edit"):
handle_update_command(ack, body, command, respond)
elif subcommand == "subject":
elif subcommand in ("subject", "title"):
if not args:
ack()
cmd = command.get("command", "/ft")
Expand Down
2 changes: 1 addition & 1 deletion src/firetower/slack_app/handlers/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def handle_help_command(ack: Any, command: dict, respond: Any) -> None:
f" `{cmd} help` - Show this help message\n"
f" `{cmd} new` - Create a new incident\n"
f" `{cmd} severity <P0-P4>` - Change incident severity (alias: `{cmd} sev`)\n"
f" `{cmd} subject <title>` - Change incident title\n"
f" `{cmd} subject <title>` - Change incident title (alias: `{cmd} title`)\n"
f" `{cmd} captain` - Set incident captain (alias: `{cmd} ic`)\n"
f" `{cmd} update` - Interactively update incident metadata (alias: `{cmd} edit`)\n"
f" `{cmd} mitigated` - Mark incident as mitigated (alias: `{cmd} mit`)\n"
Expand Down
12 changes: 12 additions & 0 deletions src/firetower/slack_app/tests/test_bolt.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,18 @@ def test_subject_routes_with_arg(self, mock_statsd, incident):
mock_handler.assert_called_once()
assert mock_handler.call_args[1]["new_subject"] == "New Title Here"

@patch("firetower.slack_app.bolt.statsd")
def test_title_alias_routes_to_subject(self, mock_statsd, incident):
ack = MagicMock()
respond = MagicMock()
body = {"text": "title New Title Here", "channel_id": CHANNEL_ID}
command = {"command": "/inc"}

with patch("firetower.slack_app.bolt.handle_subject_command") as mock_handler:
handle_command(ack=ack, body=body, command=command, respond=respond)
mock_handler.assert_called_once()
assert mock_handler.call_args[1]["new_subject"] == "New Title Here"

@patch("firetower.slack_app.bolt.statsd")
def test_subject_no_arg_shows_usage(self, mock_statsd, incident):
ack = MagicMock()
Expand Down
Loading