We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Recently Active Members should be first on the dropdown
When selecting an action for an issue alert, Recently Active Members should be the first option and pre-selected.

![Image](https://user-images.githubusercontent.com/1660873/254756637-1ded483a-d81f-4597-9c14-9c1b3824dad4.png)



--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/sentry/notifications/types.py`
Content:
```
1 from __future__ import annotations
2 
3 from enum import Enum
4 from typing import Optional
5 
6 from sentry.services.hybrid_cloud import ValueEqualityEnum
7 
8 """
9 TODO(postgres): We've encoded these enums as integers to facilitate
10 communication with the DB. We'd prefer to encode them as strings to facilitate
11 communication with the API and plan to do so as soon as we use native enums in
12 Postgres. In the meantime each enum has an adjacent object that maps the
13 integers to their string values.
14 """
15 
16 
17 def get_notification_setting_type_name(value: int | NotificationSettingTypes) -> Optional[str]:
18     return NOTIFICATION_SETTING_TYPES.get(NotificationSettingTypes(value))
19 
20 
21 def get_notification_setting_value_name(value: int) -> Optional[str]:
22     return NOTIFICATION_SETTING_OPTION_VALUES.get(NotificationSettingOptionValues(value))
23 
24 
25 def get_notification_scope_name(value: int) -> Optional[str]:
26     return NOTIFICATION_SCOPE_TYPE.get(NotificationScopeType(value))
27 
28 
29 class NotificationSettingTypes(ValueEqualityEnum):
30     """
31     Each of these categories of Notification settings has at least an option for
32     "on" or "off". Workflow also includes SUBSCRIBE_ONLY and Deploy also
33     includes COMMITTED_ONLY and both of these values are described below.
34     """
35 
36     # Control all notification types. Currently unused.
37     DEFAULT = 0
38 
39     # When Sentry sees there is a new code deploy.
40     DEPLOY = 10
41 
42     # When Sentry sees and issue that triggers an Alert Rule.
43     ISSUE_ALERTS = 20
44 
45     # Notifications for changes in assignment, resolution, comments, etc.
46     WORKFLOW = 30
47 
48     # Notification when an issue happens shortly after your release. This notification type is no longer supported.
49     ACTIVE_RELEASE = 31
50 
51     # Notifications that require approval like a request to invite a member
52     APPROVAL = 40
53 
54     # Notifications about quotas
55     QUOTA = 50
56 
57     # Sub category of quotas for each event category
58     QUOTA_ERRORS = 51
59     QUOTA_TRANSACTIONS = 52
60     QUOTA_ATTACHMENTS = 53
61     QUOTA_REPLAYS = 56
62 
63     # Sub category of quotas for warnings before hitting the actual limit
64     QUOTA_WARNINGS = 54
65 
66     # Sub category of quotas for spend allocation notifications
67     QUOTA_SPEND_ALLOCATIONS = 55
68 
69     # Notifications about spikes
70     SPIKE_PROTECTION = 60
71 
72 
73 NOTIFICATION_SETTING_TYPES = {
74     NotificationSettingTypes.DEFAULT: "default",
75     NotificationSettingTypes.DEPLOY: "deploy",
76     NotificationSettingTypes.ISSUE_ALERTS: "alerts",
77     NotificationSettingTypes.WORKFLOW: "workflow",
78     NotificationSettingTypes.ACTIVE_RELEASE: "activeRelease",
79     NotificationSettingTypes.APPROVAL: "approval",
80     NotificationSettingTypes.QUOTA: "quota",
81     NotificationSettingTypes.QUOTA_ERRORS: "quotaErrors",
82     NotificationSettingTypes.QUOTA_TRANSACTIONS: "quotaTransactions",
83     NotificationSettingTypes.QUOTA_ATTACHMENTS: "quotaAttachments",
84     NotificationSettingTypes.QUOTA_REPLAYS: "quotaReplays",
85     NotificationSettingTypes.QUOTA_WARNINGS: "quotaWarnings",
86     NotificationSettingTypes.QUOTA_SPEND_ALLOCATIONS: "quotaSpendAllocations",
87     NotificationSettingTypes.SPIKE_PROTECTION: "spikeProtection",
88 }
89 
90 
91 class NotificationSettingOptionValues(ValueEqualityEnum):
92     """
93     An empty row in the DB should be represented as
94     NotificationSettingOptionValues.DEFAULT.
95     """
96 
97     # Defer to a setting one level up.
98     DEFAULT = 0
99 
100     # Mute this kind of notification.
101     NEVER = 10
102 
103     # Un-mute this kind of notification.
104     ALWAYS = 20
105 
106     # Workflow only. Only send notifications about Issues that the target has
107     # explicitly or implicitly opted-into.
108     SUBSCRIBE_ONLY = 30
109 
110     # Deploy only. Only send notifications when the set of changes in the deploy
111     # included a commit authored by the target.
112     COMMITTED_ONLY = 40
113 
114 
115 NOTIFICATION_SETTING_OPTION_VALUES = {
116     NotificationSettingOptionValues.DEFAULT: "default",
117     NotificationSettingOptionValues.NEVER: "never",
118     NotificationSettingOptionValues.ALWAYS: "always",
119     NotificationSettingOptionValues.SUBSCRIBE_ONLY: "subscribe_only",
120     NotificationSettingOptionValues.COMMITTED_ONLY: "committed_only",
121 }
122 
123 
124 class NotificationScopeType(ValueEqualityEnum):
125     USER = 0
126     ORGANIZATION = 10
127     PROJECT = 20
128     TEAM = 30
129 
130 
131 NOTIFICATION_SCOPE_TYPE = {
132     NotificationScopeType.USER: "user",
133     NotificationScopeType.ORGANIZATION: "organization",
134     NotificationScopeType.PROJECT: "project",
135     NotificationScopeType.TEAM: "team",
136 }
137 
138 
139 class FineTuningAPIKey(Enum):
140     ALERTS = "alerts"
141     APPROVAL = "approval"
142     DEPLOY = "deploy"
143     EMAIL = "email"
144     QUOTA = "quota"
145     REPORTS = "reports"
146     WORKFLOW = "workflow"
147     SPIKE_PROTECTION = "spikeProtection"
148 
149 
150 class UserOptionsSettingsKey(Enum):
151     DEPLOY = "deployNotifications"
152     SELF_ACTIVITY = "personalActivityNotifications"
153     SELF_ASSIGN = "selfAssignOnResolve"
154     SUBSCRIBE_BY_DEFAULT = "subscribeByDefault"
155     WORKFLOW = "workflowNotifications"
156     ACTIVE_RELEASE = "activeReleaseNotifications"
157     APPROVAL = "approvalNotifications"
158     QUOTA = "quotaNotifications"
159     SPIKE_PROTECTION = "spikeProtectionNotifications"
160 
161 
162 VALID_VALUES_FOR_KEY = {
163     NotificationSettingTypes.APPROVAL: {
164         NotificationSettingOptionValues.ALWAYS,
165         NotificationSettingOptionValues.NEVER,
166     },
167     NotificationSettingTypes.DEPLOY: {
168         NotificationSettingOptionValues.ALWAYS,
169         NotificationSettingOptionValues.COMMITTED_ONLY,
170         NotificationSettingOptionValues.NEVER,
171     },
172     NotificationSettingTypes.ISSUE_ALERTS: {
173         NotificationSettingOptionValues.ALWAYS,
174         NotificationSettingOptionValues.NEVER,
175     },
176     NotificationSettingTypes.QUOTA: {
177         NotificationSettingOptionValues.ALWAYS,
178         NotificationSettingOptionValues.NEVER,
179     },
180     NotificationSettingTypes.QUOTA_ERRORS: {
181         NotificationSettingOptionValues.ALWAYS,
182         NotificationSettingOptionValues.NEVER,
183     },
184     NotificationSettingTypes.QUOTA_TRANSACTIONS: {
185         NotificationSettingOptionValues.ALWAYS,
186         NotificationSettingOptionValues.NEVER,
187     },
188     NotificationSettingTypes.QUOTA_ATTACHMENTS: {
189         NotificationSettingOptionValues.ALWAYS,
190         NotificationSettingOptionValues.NEVER,
191     },
192     NotificationSettingTypes.QUOTA_REPLAYS: {
193         NotificationSettingOptionValues.ALWAYS,
194         NotificationSettingOptionValues.NEVER,
195     },
196     NotificationSettingTypes.QUOTA_WARNINGS: {
197         NotificationSettingOptionValues.ALWAYS,
198         NotificationSettingOptionValues.NEVER,
199     },
200     NotificationSettingTypes.QUOTA_SPEND_ALLOCATIONS: {
201         NotificationSettingOptionValues.ALWAYS,
202         NotificationSettingOptionValues.NEVER,
203     },
204     NotificationSettingTypes.WORKFLOW: {
205         NotificationSettingOptionValues.ALWAYS,
206         NotificationSettingOptionValues.SUBSCRIBE_ONLY,
207         NotificationSettingOptionValues.NEVER,
208     },
209     NotificationSettingTypes.SPIKE_PROTECTION: {
210         NotificationSettingOptionValues.ALWAYS,
211         NotificationSettingOptionValues.NEVER,
212     },
213 }
214 
215 
216 class GroupSubscriptionReason:
217     implicit = -1  # not for use as a persisted field value
218     committed = -2  # not for use as a persisted field value
219     processing_issue = -3  # not for use as a persisted field value
220 
221     unknown = 0
222     comment = 1
223     assigned = 2
224     bookmark = 3
225     status_change = 4
226     deploy_setting = 5
227     mentioned = 6
228     team_mentioned = 7
229 
230     descriptions = {
231         implicit: "have opted to receive updates for all issues within "
232         "projects that you are a member of",
233         committed: "were involved in a commit that is part of this release",
234         processing_issue: "are subscribed to alerts for this project",
235         comment: "have commented on this issue",
236         assigned: "have been assigned to this issue",
237         bookmark: "have bookmarked this issue",
238         status_change: "have changed the resolution status of this issue",
239         deploy_setting: "opted to receive all deploy notifications for this organization",
240         mentioned: "have been mentioned in this issue",
241         team_mentioned: "are a member of a team mentioned in this issue",
242     }
243 
244 
245 SUBSCRIPTION_REASON_MAP = {
246     GroupSubscriptionReason.comment: "commented",
247     GroupSubscriptionReason.assigned: "assigned",
248     GroupSubscriptionReason.bookmark: "bookmarked",
249     GroupSubscriptionReason.status_change: "changed_status",
250     GroupSubscriptionReason.mentioned: "mentioned",
251 }
252 
253 
254 class ActionTargetType(Enum):
255     ISSUE_OWNERS = "IssueOwners"
256     TEAM = "Team"
257     MEMBER = "Member"
258 
259 
260 ACTION_CHOICES = [
261     (ActionTargetType.ISSUE_OWNERS.value, "Issue Owners"),
262     (ActionTargetType.TEAM.value, "Team"),
263     (ActionTargetType.MEMBER.value, "Member"),
264 ]
265 
266 
267 class FallthroughChoiceType(Enum):
268     ALL_MEMBERS = "AllMembers"
269     ACTIVE_MEMBERS = "ActiveMembers"
270     NO_ONE = "NoOne"
271 
272 
273 FALLTHROUGH_CHOICES = [
274     (FallthroughChoiceType.ALL_MEMBERS.value, "All Project Members"),
275     (FallthroughChoiceType.ACTIVE_MEMBERS.value, "Recently Active Members"),
276     (FallthroughChoiceType.NO_ONE.value, "No One"),
277 ]
278 
279 
280 class AssigneeTargetType(Enum):
281     UNASSIGNED = "Unassigned"
282     TEAM = "Team"
283     MEMBER = "Member"
284 
285 
286 ASSIGNEE_CHOICES = [
287     (AssigneeTargetType.UNASSIGNED.value, "Unassigned"),
288     (AssigneeTargetType.TEAM.value, "Team"),
289     (AssigneeTargetType.MEMBER.value, "Member"),
290 ]
291
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/sentry/notifications/types.py b/src/sentry/notifications/types.py
--- a/src/sentry/notifications/types.py
+++ b/src/sentry/notifications/types.py
@@ -271,8 +271,8 @@
 
 
 FALLTHROUGH_CHOICES = [
-    (FallthroughChoiceType.ALL_MEMBERS.value, "All Project Members"),
     (FallthroughChoiceType.ACTIVE_MEMBERS.value, "Recently Active Members"),
+    (FallthroughChoiceType.ALL_MEMBERS.value, "All Project Members"),
     (FallthroughChoiceType.NO_ONE.value, "No One"),
 ]

{"golden_diff": "diff --git a/src/sentry/notifications/types.py b/src/sentry/notifications/types.py\n--- a/src/sentry/notifications/types.py\n+++ b/src/sentry/notifications/types.py\n@@ -271,8 +271,8 @@\n \n \n FALLTHROUGH_CHOICES = [\n-    (FallthroughChoiceType.ALL_MEMBERS.value, \"All Project Members\"),\n     (FallthroughChoiceType.ACTIVE_MEMBERS.value, \"Recently Active Members\"),\n+    (FallthroughChoiceType.ALL_MEMBERS.value, \"All Project Members\"),\n     (FallthroughChoiceType.NO_ONE.value, \"No One\"),\n ]\n", "issue": "Recently Active Members should be first on the dropdown\nWhen selecting an action for an issue alert, Recently Active Members should be the first option and pre-selected.\n\n![Image](https://user-images.githubusercontent.com/1660873/254756637-1ded483a-d81f-4597-9c14-9c1b3824dad4.png)\n\n\n", "before_files": [{"content": "from __future__ import annotations\n\nfrom enum import Enum\nfrom typing import Optional\n\nfrom sentry.services.hybrid_cloud import ValueEqualityEnum\n\n\"\"\"\nTODO(postgres): We've encoded these enums as integers to facilitate\ncommunication with the DB. We'd prefer to encode them as strings to facilitate\ncommunication with the API and plan to do so as soon as we use native enums in\nPostgres. In the meantime each enum has an adjacent object that maps the\nintegers to their string values.\n\"\"\"\n\n\ndef get_notification_setting_type_name(value: int | NotificationSettingTypes) -> Optional[str]:\n    return NOTIFICATION_SETTING_TYPES.get(NotificationSettingTypes(value))\n\n\ndef get_notification_setting_value_name(value: int) -> Optional[str]:\n    return NOTIFICATION_SETTING_OPTION_VALUES.get(NotificationSettingOptionValues(value))\n\n\ndef get_notification_scope_name(value: int) -> Optional[str]:\n    return NOTIFICATION_SCOPE_TYPE.get(NotificationScopeType(value))\n\n\nclass NotificationSettingTypes(ValueEqualityEnum):\n    \"\"\"\n    Each of these categories of Notification settings has at least an option for\n    \"on\" or \"off\". Workflow also includes SUBSCRIBE_ONLY and Deploy also\n    includes COMMITTED_ONLY and both of these values are described below.\n    \"\"\"\n\n    # Control all notification types. Currently unused.\n    DEFAULT = 0\n\n    # When Sentry sees there is a new code deploy.\n    DEPLOY = 10\n\n    # When Sentry sees and issue that triggers an Alert Rule.\n    ISSUE_ALERTS = 20\n\n    # Notifications for changes in assignment, resolution, comments, etc.\n    WORKFLOW = 30\n\n    # Notification when an issue happens shortly after your release. This notification type is no longer supported.\n    ACTIVE_RELEASE = 31\n\n    # Notifications that require approval like a request to invite a member\n    APPROVAL = 40\n\n    # Notifications about quotas\n    QUOTA = 50\n\n    # Sub category of quotas for each event category\n    QUOTA_ERRORS = 51\n    QUOTA_TRANSACTIONS = 52\n    QUOTA_ATTACHMENTS = 53\n    QUOTA_REPLAYS = 56\n\n    # Sub category of quotas for warnings before hitting the actual limit\n    QUOTA_WARNINGS = 54\n\n    # Sub category of quotas for spend allocation notifications\n    QUOTA_SPEND_ALLOCATIONS = 55\n\n    # Notifications about spikes\n    SPIKE_PROTECTION = 60\n\n\nNOTIFICATION_SETTING_TYPES = {\n    NotificationSettingTypes.DEFAULT: \"default\",\n    NotificationSettingTypes.DEPLOY: \"deploy\",\n    NotificationSettingTypes.ISSUE_ALERTS: \"alerts\",\n    NotificationSettingTypes.WORKFLOW: \"workflow\",\n    NotificationSettingTypes.ACTIVE_RELEASE: \"activeRelease\",\n    NotificationSettingTypes.APPROVAL: \"approval\",\n    NotificationSettingTypes.QUOTA: \"quota\",\n    NotificationSettingTypes.QUOTA_ERRORS: \"quotaErrors\",\n    NotificationSettingTypes.QUOTA_TRANSACTIONS: \"quotaTransactions\",\n    NotificationSettingTypes.QUOTA_ATTACHMENTS: \"quotaAttachments\",\n    NotificationSettingTypes.QUOTA_REPLAYS: \"quotaReplays\",\n    NotificationSettingTypes.QUOTA_WARNINGS: \"quotaWarnings\",\n    NotificationSettingTypes.QUOTA_SPEND_ALLOCATIONS: \"quotaSpendAllocations\",\n    NotificationSettingTypes.SPIKE_PROTECTION: \"spikeProtection\",\n}\n\n\nclass NotificationSettingOptionValues(ValueEqualityEnum):\n    \"\"\"\n    An empty row in the DB should be represented as\n    NotificationSettingOptionValues.DEFAULT.\n    \"\"\"\n\n    # Defer to a setting one level up.\n    DEFAULT = 0\n\n    # Mute this kind of notification.\n    NEVER = 10\n\n    # Un-mute this kind of notification.\n    ALWAYS = 20\n\n    # Workflow only. Only send notifications about Issues that the target has\n    # explicitly or implicitly opted-into.\n    SUBSCRIBE_ONLY = 30\n\n    # Deploy only. Only send notifications when the set of changes in the deploy\n    # included a commit authored by the target.\n    COMMITTED_ONLY = 40\n\n\nNOTIFICATION_SETTING_OPTION_VALUES = {\n    NotificationSettingOptionValues.DEFAULT: \"default\",\n    NotificationSettingOptionValues.NEVER: \"never\",\n    NotificationSettingOptionValues.ALWAYS: \"always\",\n    NotificationSettingOptionValues.SUBSCRIBE_ONLY: \"subscribe_only\",\n    NotificationSettingOptionValues.COMMITTED_ONLY: \"committed_only\",\n}\n\n\nclass NotificationScopeType(ValueEqualityEnum):\n    USER = 0\n    ORGANIZATION = 10\n    PROJECT = 20\n    TEAM = 30\n\n\nNOTIFICATION_SCOPE_TYPE = {\n    NotificationScopeType.USER: \"user\",\n    NotificationScopeType.ORGANIZATION: \"organization\",\n    NotificationScopeType.PROJECT: \"project\",\n    NotificationScopeType.TEAM: \"team\",\n}\n\n\nclass FineTuningAPIKey(Enum):\n    ALERTS = \"alerts\"\n    APPROVAL = \"approval\"\n    DEPLOY = \"deploy\"\n    EMAIL = \"email\"\n    QUOTA = \"quota\"\n    REPORTS = \"reports\"\n    WORKFLOW = \"workflow\"\n    SPIKE_PROTECTION = \"spikeProtection\"\n\n\nclass UserOptionsSettingsKey(Enum):\n    DEPLOY = \"deployNotifications\"\n    SELF_ACTIVITY = \"personalActivityNotifications\"\n    SELF_ASSIGN = \"selfAssignOnResolve\"\n    SUBSCRIBE_BY_DEFAULT = \"subscribeByDefault\"\n    WORKFLOW = \"workflowNotifications\"\n    ACTIVE_RELEASE = \"activeReleaseNotifications\"\n    APPROVAL = \"approvalNotifications\"\n    QUOTA = \"quotaNotifications\"\n    SPIKE_PROTECTION = \"spikeProtectionNotifications\"\n\n\nVALID_VALUES_FOR_KEY = {\n    NotificationSettingTypes.APPROVAL: {\n        NotificationSettingOptionValues.ALWAYS,\n        NotificationSettingOptionValues.NEVER,\n    },\n    NotificationSettingTypes.DEPLOY: {\n        NotificationSettingOptionValues.ALWAYS,\n        NotificationSettingOptionValues.COMMITTED_ONLY,\n        NotificationSettingOptionValues.NEVER,\n    },\n    NotificationSettingTypes.ISSUE_ALERTS: {\n        NotificationSettingOptionValues.ALWAYS,\n        NotificationSettingOptionValues.NEVER,\n    },\n    NotificationSettingTypes.QUOTA: {\n        NotificationSettingOptionValues.ALWAYS,\n        NotificationSettingOptionValues.NEVER,\n    },\n    NotificationSettingTypes.QUOTA_ERRORS: {\n        NotificationSettingOptionValues.ALWAYS,\n        NotificationSettingOptionValues.NEVER,\n    },\n    NotificationSettingTypes.QUOTA_TRANSACTIONS: {\n        NotificationSettingOptionValues.ALWAYS,\n        NotificationSettingOptionValues.NEVER,\n    },\n    NotificationSettingTypes.QUOTA_ATTACHMENTS: {\n        NotificationSettingOptionValues.ALWAYS,\n        NotificationSettingOptionValues.NEVER,\n    },\n    NotificationSettingTypes.QUOTA_REPLAYS: {\n        NotificationSettingOptionValues.ALWAYS,\n        NotificationSettingOptionValues.NEVER,\n    },\n    NotificationSettingTypes.QUOTA_WARNINGS: {\n        NotificationSettingOptionValues.ALWAYS,\n        NotificationSettingOptionValues.NEVER,\n    },\n    NotificationSettingTypes.QUOTA_SPEND_ALLOCATIONS: {\n        NotificationSettingOptionValues.ALWAYS,\n        NotificationSettingOptionValues.NEVER,\n    },\n    NotificationSettingTypes.WORKFLOW: {\n        NotificationSettingOptionValues.ALWAYS,\n        NotificationSettingOptionValues.SUBSCRIBE_ONLY,\n        NotificationSettingOptionValues.NEVER,\n    },\n    NotificationSettingTypes.SPIKE_PROTECTION: {\n        NotificationSettingOptionValues.ALWAYS,\n        NotificationSettingOptionValues.NEVER,\n    },\n}\n\n\nclass GroupSubscriptionReason:\n    implicit = -1  # not for use as a persisted field value\n    committed = -2  # not for use as a persisted field value\n    processing_issue = -3  # not for use as a persisted field value\n\n    unknown = 0\n    comment = 1\n    assigned = 2\n    bookmark = 3\n    status_change = 4\n    deploy_setting = 5\n    mentioned = 6\n    team_mentioned = 7\n\n    descriptions = {\n        implicit: \"have opted to receive updates for all issues within \"\n        \"projects that you are a member of\",\n        committed: \"were involved in a commit that is part of this release\",\n        processing_issue: \"are subscribed to alerts for this project\",\n        comment: \"have commented on this issue\",\n        assigned: \"have been assigned to this issue\",\n        bookmark: \"have bookmarked this issue\",\n        status_change: \"have changed the resolution status of this issue\",\n        deploy_setting: \"opted to receive all deploy notifications for this organization\",\n        mentioned: \"have been mentioned in this issue\",\n        team_mentioned: \"are a member of a team mentioned in this issue\",\n    }\n\n\nSUBSCRIPTION_REASON_MAP = {\n    GroupSubscriptionReason.comment: \"commented\",\n    GroupSubscriptionReason.assigned: \"assigned\",\n    GroupSubscriptionReason.bookmark: \"bookmarked\",\n    GroupSubscriptionReason.status_change: \"changed_status\",\n    GroupSubscriptionReason.mentioned: \"mentioned\",\n}\n\n\nclass ActionTargetType(Enum):\n    ISSUE_OWNERS = \"IssueOwners\"\n    TEAM = \"Team\"\n    MEMBER = \"Member\"\n\n\nACTION_CHOICES = [\n    (ActionTargetType.ISSUE_OWNERS.value, \"Issue Owners\"),\n    (ActionTargetType.TEAM.value, \"Team\"),\n    (ActionTargetType.MEMBER.value, \"Member\"),\n]\n\n\nclass FallthroughChoiceType(Enum):\n    ALL_MEMBERS = \"AllMembers\"\n    ACTIVE_MEMBERS = \"ActiveMembers\"\n    NO_ONE = \"NoOne\"\n\n\nFALLTHROUGH_CHOICES = [\n    (FallthroughChoiceType.ALL_MEMBERS.value, \"All Project Members\"),\n    (FallthroughChoiceType.ACTIVE_MEMBERS.value, \"Recently Active Members\"),\n    (FallthroughChoiceType.NO_ONE.value, \"No One\"),\n]\n\n\nclass AssigneeTargetType(Enum):\n    UNASSIGNED = \"Unassigned\"\n    TEAM = \"Team\"\n    MEMBER = \"Member\"\n\n\nASSIGNEE_CHOICES = [\n    (AssigneeTargetType.UNASSIGNED.value, \"Unassigned\"),\n    (AssigneeTargetType.TEAM.value, \"Team\"),\n    (AssigneeTargetType.MEMBER.value, \"Member\"),\n]\n", "path": "src/sentry/notifications/types.py"}], "after_files": [{"content": "from __future__ import annotations\n\nfrom enum import Enum\nfrom typing import Optional\n\nfrom sentry.services.hybrid_cloud import ValueEqualityEnum\n\n\"\"\"\nTODO(postgres): We've encoded these enums as integers to facilitate\ncommunication with the DB. We'd prefer to encode them as strings to facilitate\ncommunication with the API and plan to do so as soon as we use native enums in\nPostgres. In the meantime each enum has an adjacent object that maps the\nintegers to their string values.\n\"\"\"\n\n\ndef get_notification_setting_type_name(value: int | NotificationSettingTypes) -> Optional[str]:\n    return NOTIFICATION_SETTING_TYPES.get(NotificationSettingTypes(value))\n\n\ndef get_notification_setting_value_name(value: int) -> Optional[str]:\n    return NOTIFICATION_SETTING_OPTION_VALUES.get(NotificationSettingOptionValues(value))\n\n\ndef get_notification_scope_name(value: int) -> Optional[str]:\n    return NOTIFICATION_SCOPE_TYPE.get(NotificationScopeType(value))\n\n\nclass NotificationSettingTypes(ValueEqualityEnum):\n    \"\"\"\n    Each of these categories of Notification settings has at least an option for\n    \"on\" or \"off\". Workflow also includes SUBSCRIBE_ONLY and Deploy also\n    includes COMMITTED_ONLY and both of these values are described below.\n    \"\"\"\n\n    # Control all notification types. Currently unused.\n    DEFAULT = 0\n\n    # When Sentry sees there is a new code deploy.\n    DEPLOY = 10\n\n    # When Sentry sees and issue that triggers an Alert Rule.\n    ISSUE_ALERTS = 20\n\n    # Notifications for changes in assignment, resolution, comments, etc.\n    WORKFLOW = 30\n\n    # Notification when an issue happens shortly after your release. This notification type is no longer supported.\n    ACTIVE_RELEASE = 31\n\n    # Notifications that require approval like a request to invite a member\n    APPROVAL = 40\n\n    # Notifications about quotas\n    QUOTA = 50\n\n    # Sub category of quotas for each event category\n    QUOTA_ERRORS = 51\n    QUOTA_TRANSACTIONS = 52\n    QUOTA_ATTACHMENTS = 53\n    QUOTA_REPLAYS = 56\n\n    # Sub category of quotas for warnings before hitting the actual limit\n    QUOTA_WARNINGS = 54\n\n    # Sub category of quotas for spend allocation notifications\n    QUOTA_SPEND_ALLOCATIONS = 55\n\n    # Notifications about spikes\n    SPIKE_PROTECTION = 60\n\n\nNOTIFICATION_SETTING_TYPES = {\n    NotificationSettingTypes.DEFAULT: \"default\",\n    NotificationSettingTypes.DEPLOY: \"deploy\",\n    NotificationSettingTypes.ISSUE_ALERTS: \"alerts\",\n    NotificationSettingTypes.WORKFLOW: \"workflow\",\n    NotificationSettingTypes.ACTIVE_RELEASE: \"activeRelease\",\n    NotificationSettingTypes.APPROVAL: \"approval\",\n    NotificationSettingTypes.QUOTA: \"quota\",\n    NotificationSettingTypes.QUOTA_ERRORS: \"quotaErrors\",\n    NotificationSettingTypes.QUOTA_TRANSACTIONS: \"quotaTransactions\",\n    NotificationSettingTypes.QUOTA_ATTACHMENTS: \"quotaAttachments\",\n    NotificationSettingTypes.QUOTA_REPLAYS: \"quotaReplays\",\n    NotificationSettingTypes.QUOTA_WARNINGS: \"quotaWarnings\",\n    NotificationSettingTypes.QUOTA_SPEND_ALLOCATIONS: \"quotaSpendAllocations\",\n    NotificationSettingTypes.SPIKE_PROTECTION: \"spikeProtection\",\n}\n\n\nclass NotificationSettingOptionValues(ValueEqualityEnum):\n    \"\"\"\n    An empty row in the DB should be represented as\n    NotificationSettingOptionValues.DEFAULT.\n    \"\"\"\n\n    # Defer to a setting one level up.\n    DEFAULT = 0\n\n    # Mute this kind of notification.\n    NEVER = 10\n\n    # Un-mute this kind of notification.\n    ALWAYS = 20\n\n    # Workflow only. Only send notifications about Issues that the target has\n    # explicitly or implicitly opted-into.\n    SUBSCRIBE_ONLY = 30\n\n    # Deploy only. Only send notifications when the set of changes in the deploy\n    # included a commit authored by the target.\n    COMMITTED_ONLY = 40\n\n\nNOTIFICATION_SETTING_OPTION_VALUES = {\n    NotificationSettingOptionValues.DEFAULT: \"default\",\n    NotificationSettingOptionValues.NEVER: \"never\",\n    NotificationSettingOptionValues.ALWAYS: \"always\",\n    NotificationSettingOptionValues.SUBSCRIBE_ONLY: \"subscribe_only\",\n    NotificationSettingOptionValues.COMMITTED_ONLY: \"committed_only\",\n}\n\n\nclass NotificationScopeType(ValueEqualityEnum):\n    USER = 0\n    ORGANIZATION = 10\n    PROJECT = 20\n    TEAM = 30\n\n\nNOTIFICATION_SCOPE_TYPE = {\n    NotificationScopeType.USER: \"user\",\n    NotificationScopeType.ORGANIZATION: \"organization\",\n    NotificationScopeType.PROJECT: \"project\",\n    NotificationScopeType.TEAM: \"team\",\n}\n\n\nclass FineTuningAPIKey(Enum):\n    ALERTS = \"alerts\"\n    APPROVAL = \"approval\"\n    DEPLOY = \"deploy\"\n    EMAIL = \"email\"\n    QUOTA = \"quota\"\n    REPORTS = \"reports\"\n    WORKFLOW = \"workflow\"\n    SPIKE_PROTECTION = \"spikeProtection\"\n\n\nclass UserOptionsSettingsKey(Enum):\n    DEPLOY = \"deployNotifications\"\n    SELF_ACTIVITY = \"personalActivityNotifications\"\n    SELF_ASSIGN = \"selfAssignOnResolve\"\n    SUBSCRIBE_BY_DEFAULT = \"subscribeByDefault\"\n    WORKFLOW = \"workflowNotifications\"\n    ACTIVE_RELEASE = \"activeReleaseNotifications\"\n    APPROVAL = \"approvalNotifications\"\n    QUOTA = \"quotaNotifications\"\n    SPIKE_PROTECTION = \"spikeProtectionNotifications\"\n\n\nVALID_VALUES_FOR_KEY = {\n    NotificationSettingTypes.APPROVAL: {\n        NotificationSettingOptionValues.ALWAYS,\n        NotificationSettingOptionValues.NEVER,\n    },\n    NotificationSettingTypes.DEPLOY: {\n        NotificationSettingOptionValues.ALWAYS,\n        NotificationSettingOptionValues.COMMITTED_ONLY,\n        NotificationSettingOptionValues.NEVER,\n    },\n    NotificationSettingTypes.ISSUE_ALERTS: {\n        NotificationSettingOptionValues.ALWAYS,\n        NotificationSettingOptionValues.NEVER,\n    },\n    NotificationSettingTypes.QUOTA: {\n        NotificationSettingOptionValues.ALWAYS,\n        NotificationSettingOptionValues.NEVER,\n    },\n    NotificationSettingTypes.QUOTA_ERRORS: {\n        NotificationSettingOptionValues.ALWAYS,\n        NotificationSettingOptionValues.NEVER,\n    },\n    NotificationSettingTypes.QUOTA_TRANSACTIONS: {\n        NotificationSettingOptionValues.ALWAYS,\n        NotificationSettingOptionValues.NEVER,\n    },\n    NotificationSettingTypes.QUOTA_ATTACHMENTS: {\n        NotificationSettingOptionValues.ALWAYS,\n        NotificationSettingOptionValues.NEVER,\n    },\n    NotificationSettingTypes.QUOTA_REPLAYS: {\n        NotificationSettingOptionValues.ALWAYS,\n        NotificationSettingOptionValues.NEVER,\n    },\n    NotificationSettingTypes.QUOTA_WARNINGS: {\n        NotificationSettingOptionValues.ALWAYS,\n        NotificationSettingOptionValues.NEVER,\n    },\n    NotificationSettingTypes.QUOTA_SPEND_ALLOCATIONS: {\n        NotificationSettingOptionValues.ALWAYS,\n        NotificationSettingOptionValues.NEVER,\n    },\n    NotificationSettingTypes.WORKFLOW: {\n        NotificationSettingOptionValues.ALWAYS,\n        NotificationSettingOptionValues.SUBSCRIBE_ONLY,\n        NotificationSettingOptionValues.NEVER,\n    },\n    NotificationSettingTypes.SPIKE_PROTECTION: {\n        NotificationSettingOptionValues.ALWAYS,\n        NotificationSettingOptionValues.NEVER,\n    },\n}\n\n\nclass GroupSubscriptionReason:\n    implicit = -1  # not for use as a persisted field value\n    committed = -2  # not for use as a persisted field value\n    processing_issue = -3  # not for use as a persisted field value\n\n    unknown = 0\n    comment = 1\n    assigned = 2\n    bookmark = 3\n    status_change = 4\n    deploy_setting = 5\n    mentioned = 6\n    team_mentioned = 7\n\n    descriptions = {\n        implicit: \"have opted to receive updates for all issues within \"\n        \"projects that you are a member of\",\n        committed: \"were involved in a commit that is part of this release\",\n        processing_issue: \"are subscribed to alerts for this project\",\n        comment: \"have commented on this issue\",\n        assigned: \"have been assigned to this issue\",\n        bookmark: \"have bookmarked this issue\",\n        status_change: \"have changed the resolution status of this issue\",\n        deploy_setting: \"opted to receive all deploy notifications for this organization\",\n        mentioned: \"have been mentioned in this issue\",\n        team_mentioned: \"are a member of a team mentioned in this issue\",\n    }\n\n\nSUBSCRIPTION_REASON_MAP = {\n    GroupSubscriptionReason.comment: \"commented\",\n    GroupSubscriptionReason.assigned: \"assigned\",\n    GroupSubscriptionReason.bookmark: \"bookmarked\",\n    GroupSubscriptionReason.status_change: \"changed_status\",\n    GroupSubscriptionReason.mentioned: \"mentioned\",\n}\n\n\nclass ActionTargetType(Enum):\n    ISSUE_OWNERS = \"IssueOwners\"\n    TEAM = \"Team\"\n    MEMBER = \"Member\"\n\n\nACTION_CHOICES = [\n    (ActionTargetType.ISSUE_OWNERS.value, \"Issue Owners\"),\n    (ActionTargetType.TEAM.value, \"Team\"),\n    (ActionTargetType.MEMBER.value, \"Member\"),\n]\n\n\nclass FallthroughChoiceType(Enum):\n    ALL_MEMBERS = \"AllMembers\"\n    ACTIVE_MEMBERS = \"ActiveMembers\"\n    NO_ONE = \"NoOne\"\n\n\nFALLTHROUGH_CHOICES = [\n    (FallthroughChoiceType.ACTIVE_MEMBERS.value, \"Recently Active Members\"),\n    (FallthroughChoiceType.ALL_MEMBERS.value, \"All Project Members\"),\n    (FallthroughChoiceType.NO_ONE.value, \"No One\"),\n]\n\n\nclass AssigneeTargetType(Enum):\n    UNASSIGNED = \"Unassigned\"\n    TEAM = \"Team\"\n    MEMBER = \"Member\"\n\n\nASSIGNEE_CHOICES = [\n    (AssigneeTargetType.UNASSIGNED.value, \"Unassigned\"),\n    (AssigneeTargetType.TEAM.value, \"Team\"),\n    (AssigneeTargetType.MEMBER.value, \"Member\"),\n]\n", "path": "src/sentry/notifications/types.py"}]}