sentry
sentry copied to clipboard
fix(metrics-alerts): Validate Slack channel and ID when saving an alert
Metric alerts, like issue alerts, allow the user to provide a channel ID (to shortcut the async look up for a specific channel). If they do no set the channel ID, we will look up the channel name and and ask them to wait.
However, if they provide a channel ID for metric alerts, we don’t actually stop them from submitting even if the channel doesn’t exist.
This is because the endpoint would not validate it.
This change fixes two issues:
- It triggers validation in the endpoint
- It treats an empty channel ID as None
It adds the following tests:
- The name and ID match
- The channel name associated to an ID mismatches
- The channel ID does not exist
- The ID set to empty string
Fixes API-2630
@leeandher Early review request
I want to evaluate if I need to add any new tests for this