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
6 changes: 5 additions & 1 deletion src/sentry/integrations/slack/notify_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
self._pending_save = False

def clean(self) -> Mapping[str, Any]:
channel_id = self.data.get("inputChannelId") or self.data.get("input_channel_id")
channel_id = (
self.data.get("inputChannelId")
or self.data.get("input_channel_id")
or self.data.get("channel_id")
)
if channel_id:
logger.info(
"rule.slack.provide_channel_id",
Expand Down
20 changes: 17 additions & 3 deletions tests/sentry/api/endpoints/test_project_rule_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ def test_update_channel_slack(self):
)

actions[0]["channel"] = "#new_channel_name"
actions[0]["channel_id"] = "new_channel_id"

url = reverse(
"sentry-api-0-project-rule-details",
Expand All @@ -436,6 +437,13 @@ def test_update_channel_slack(self):
content_type="application/json",
body=json.dumps(channels),
)
responses.add(
method=responses.GET,
url="https://slack.com/api/conversations.info",
status=200,
content_type="application/json",
body=json.dumps({"ok": channels["ok"], "channel": channels["channels"][1]}),
)

response = self.client.put(
url,
Expand Down Expand Up @@ -502,14 +510,20 @@ def test_update_channel_slack_workspace_fail(self):
{"name": "new_channel_name", "id": "new_channel_id"},
],
}

responses.add(
method=responses.GET,
url="https://slack.com/api/channels.list",
url="https://slack.com/api/conversations.list",
status=200,
content_type="application/json",
body=json.dumps(channels),
)
responses.add(
method=responses.GET,
url="https://slack.com/api/conversations.info",
status=200,
content_type="application/json",
body=json.dumps({"ok": channels["ok"], "channel": channels["channels"][0]}),
)

response = self.client.put(
url,
Expand Down Expand Up @@ -574,7 +588,7 @@ def test_slack_channel_id_saved(self):
"name": "Send a notification to the funinthesun Slack workspace to #team-team-team and show tags [] in notification",
"workspace": integration.id,
"channel": "#team-team-team",
"input_channel_id": "CSVK0921",
"channel_id": "CSVK0921",
}
],
"conditions": [
Expand Down