sentry icon indicating copy to clipboard operation
sentry copied to clipboard

fix(metrics-alerts): Validate Slack channel and ID when saving an alert

Open armenzg opened this issue 3 years ago • 1 comments

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

armenzg avatar Jul 27 '22 15:07 armenzg

@leeandher Early review request

I want to evaluate if I need to add any new tests for this

armenzg avatar Jul 28 '22 18:07 armenzg