Repository: getsentry/sentry

Issue:
Unable to disable issue alert notifications for specific projects on old sentry accounts.
### Environment

SaaS (https://sentry.io/)

### Version

_No response_

### Link

_No response_

### DSN

_No response_

### Steps to Reproduce

In old accounts the default option for Fine tuning issue alert notifications was `--`, which no longer exists. (User Settings -> Notifications -> Issue alert notifications -> Fine Tune).

It seems to have been replaced with "Default" and in cases a user wants to disable the notifications for a project that currently has `--` selected, the changes to "Off" is not saved and notifications continue to be sent. 

There is no workaround as turning issue alerts notifications to OFF completely disable the notifications for all projects in all organisation, not allowing to enable for projects that man wants to receive notifications from. 

As a side note: This design is not optimal as having "On" and "Default" is redundant -> you can only set default to On, and when it is off there are no options available (Default(Off) does not exist). 

There is a recoding available in this [internal ticket (contains personal information)](https://sentry.zendesk.com/agent/tickets/84240)

### Expected Result

Changing the notification from `--` to `Off` saves and stop sending emails.

### Actual Result

The change is not saved.


Discussion:
Assigning to @getsentry/support for [routing](https://open.sentry.io/triage/#2-route), due by **<time datetime=2023-04-22T00:00:00.000Z>Friday, April 21st at 5:00 pm</time> (sfo)**. ⏲️
Routing to @getsentry/issue-experience for [triage](https://develop.sentry.dev/processing-tickets/#3-triage), due by **<time datetime=2023-04-25T00:00:00.000Z>Monday, April 24th at 5:00 pm</time> (sfo)**. ⏲️
Hi! Do you have an estimate for when this is going to be solved? Getting spammed from one of these projects :)

Resolving patch:
diff --git a/src/sentry/incidents/endpoints/bases.py b/src/sentry/incidents/endpoints/bases.py
--- a/src/sentry/incidents/endpoints/bases.py
+++ b/src/sentry/incidents/endpoints/bases.py
@@ -15,7 +15,10 @@ def convert_args(self, request: Request, alert_rule_id, *args, **kwargs):
         args, kwargs = super().convert_args(request, *args, **kwargs)
         project = kwargs["project"]
 
-        if not features.has("organizations:incidents", project.organization, actor=request.user):
+        # Allow orgs that have downgraded plans to delete metric alerts
+        if request.method != "DELETE" and not features.has(
+            "organizations:incidents", project.organization, actor=request.user
+        ):
             raise ResourceDoesNotExist
 
         if not request.access.has_project_access(project):


Test patch:
diff --git a/tests/sentry/incidents/endpoints/test_project_alert_rule_details.py b/tests/sentry/incidents/endpoints/test_project_alert_rule_details.py
--- a/tests/sentry/incidents/endpoints/test_project_alert_rule_details.py
+++ b/tests/sentry/incidents/endpoints/test_project_alert_rule_details.py
@@ -106,7 +106,9 @@ def test_permissions(self):
     def test_no_feature(self):
         self.login_as(self.owner_user)
         resp = self.get_response(self.organization.slug, self.project.slug, self.alert_rule.id)
-        assert resp.status_code == 404
+        # Without incidents feature flag, allow delete
+        status = 204 if self.method == "delete" else 404
+        assert resp.status_code == status
 
 
 @region_silo_test(stable=True)