We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[BE] Update the alerts response to include whether the alert was disabled due to being “noisy”
Similar to https://github.com/getsentry/sentry/issues/55098 - update the response to include something like `disableReason: noisy` if a `NoisyIssueAlert` entry exists for that rule id. Also need to add a `noisyDisableDate` so the front end can know whether or not to display the banner. 

--- 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/api/serializers/models/rule.py`
Content:
```
1 from collections import defaultdict
2 from typing import List
3 
4 from django.db.models import Max, Q, prefetch_related_objects
5 from rest_framework import serializers
6 
7 from sentry.api.serializers import Serializer, register
8 from sentry.constants import ObjectStatus
9 from sentry.models import (
10     ACTOR_TYPES,
11     Environment,
12     Rule,
13     RuleActivity,
14     RuleActivityType,
15     actor_type_to_string,
16 )
17 from sentry.models.actor import Actor
18 from sentry.models.rulefirehistory import RuleFireHistory
19 from sentry.models.rulesnooze import RuleSnooze
20 from sentry.services.hybrid_cloud.user.service import user_service
21 
22 
23 def _generate_rule_label(project, rule, data):
24     from sentry.rules import rules
25 
26     rule_cls = rules.get(data["id"])
27     if rule_cls is None:
28         return
29 
30     rule_inst = rule_cls(project, data=data, rule=rule)
31     return rule_inst.render_label()
32 
33 
34 def _is_filter(data):
35     from sentry.rules import rules
36 
37     rule_cls = rules.get(data["id"])
38     return rule_cls.rule_type == "filter/event"
39 
40 
41 @register(Rule)
42 class RuleSerializer(Serializer):
43     def __init__(self, expand=None):
44         super().__init__()
45         self.expand = expand or []
46 
47     def get_attrs(self, item_list, user, **kwargs):
48         from sentry.services.hybrid_cloud.app import app_service
49 
50         prefetch_related_objects(item_list, "project")
51 
52         environments = Environment.objects.in_bulk(
53             [_f for _f in [i.environment_id for i in item_list] if _f]
54         )
55 
56         result = {i: {"environment": environments.get(i.environment_id)} for i in item_list}
57         ras = list(
58             RuleActivity.objects.filter(
59                 rule__in=item_list, type=RuleActivityType.CREATED.value
60             ).select_related("rule")
61         )
62 
63         users = {
64             u.id: u for u in user_service.get_many(filter=dict(user_ids=[ra.user_id for ra in ras]))
65         }
66 
67         for rule_activity in ras:
68             u = users.get(rule_activity.user_id)
69             if u:
70                 user = {
71                     "id": u.id,
72                     "name": u.get_display_name(),
73                     "email": u.email,
74                 }
75             else:
76                 user = None
77 
78             result[rule_activity.rule].update({"created_by": user})
79 
80         rules = {item.id: item for item in item_list}
81         resolved_actors = {}
82         owners_by_type = defaultdict(list)
83 
84         sentry_app_uuids = [
85             sentry_app_uuid
86             for sentry_app_uuid in (
87                 action.get("sentryAppInstallationUuid")
88                 for rule in rules.values()
89                 for action in rule.data.get("actions", [])
90             )
91             if sentry_app_uuid is not None
92         ]
93 
94         sentry_app_ids: List[int] = [
95             i.sentry_app.id for i in app_service.get_many(filter=dict(uuids=sentry_app_uuids))
96         ]
97         sentry_app_installations_by_uuid = app_service.get_related_sentry_app_components(
98             organization_ids=[rule.project.organization_id for rule in rules.values()],
99             sentry_app_ids=sentry_app_ids,
100             type="alert-rule-action",
101             group_by="uuid",
102         )
103 
104         for item in item_list:
105             if item.owner_id is not None:
106                 owners_by_type[actor_type_to_string(item.owner.type)].append(item.owner_id)
107 
108         for k, v in ACTOR_TYPES.items():
109             actors = Actor.objects.filter(type=v, id__in=owners_by_type[k])
110             if k == "team":
111                 resolved_actors[k] = {actor.id: actor.team_id for actor in actors}
112             if k == "user":
113                 resolved_actors[k] = {actor.id: actor.user_id for actor in actors}
114 
115         for rule in rules.values():
116             if rule.owner_id:
117                 type = actor_type_to_string(rule.owner.type)
118                 if rule.owner_id in resolved_actors[type]:
119                     result[rule]["owner"] = f"{type}:{resolved_actors[type][rule.owner_id]}"
120 
121             for action in rule.data.get("actions", []):
122                 install = sentry_app_installations_by_uuid.get(
123                     str(action.get("sentryAppInstallationUuid"))
124                 )
125                 if install:
126                     action["_sentry_app_component"] = install.get("sentry_app_component")
127                     action["_sentry_app_installation"] = install.get("sentry_app_installation")
128 
129         if "lastTriggered" in self.expand:
130             last_triggered_lookup = {
131                 rfh["rule_id"]: rfh["date_added"]
132                 for rfh in RuleFireHistory.objects.filter(rule__in=item_list)
133                 .values("rule_id")
134                 .annotate(date_added=Max("date_added"))
135             }
136             for rule in item_list:
137                 result[rule]["last_triggered"] = last_triggered_lookup.get(rule.id, None)
138 
139         return result
140 
141     def serialize(self, obj, attrs, user, **kwargs):
142         environment = attrs["environment"]
143         all_conditions = [
144             dict(list(o.items()) + [("name", _generate_rule_label(obj.project, obj, o))])
145             for o in obj.data.get("conditions", [])
146         ]
147 
148         actions = []
149         for action in obj.data.get("actions", []):
150             try:
151                 actions.append(
152                     dict(
153                         list(action.items())
154                         + [("name", _generate_rule_label(obj.project, obj, action))]
155                     )
156                 )
157             except serializers.ValidationError:
158                 # Integrations can be deleted and we don't want to fail to load the rule
159                 pass
160 
161         d = {
162             # XXX(dcramer): we currently serialize unsaved rule objects
163             # as part of the rule editor
164             "id": str(obj.id) if obj.id else None,
165             # conditions pertain to criteria that can trigger an alert
166             "conditions": list(filter(lambda condition: not _is_filter(condition), all_conditions)),
167             # filters are not new conditions but are the subset of conditions that pertain to event attributes
168             "filters": list(filter(lambda condition: _is_filter(condition), all_conditions)),
169             "actions": actions,
170             "actionMatch": obj.data.get("action_match") or Rule.DEFAULT_CONDITION_MATCH,
171             "filterMatch": obj.data.get("filter_match") or Rule.DEFAULT_FILTER_MATCH,
172             "frequency": obj.data.get("frequency") or Rule.DEFAULT_FREQUENCY,
173             "name": obj.label,
174             "dateCreated": obj.date_added,
175             "owner": attrs.get("owner", None),
176             "createdBy": attrs.get("created_by", None),
177             "environment": environment.name if environment is not None else None,
178             "projects": [obj.project.slug],
179             "status": "active" if obj.status == ObjectStatus.ACTIVE else "disabled",
180         }
181         if "last_triggered" in attrs:
182             d["lastTriggered"] = attrs["last_triggered"]
183 
184         rule_snooze = RuleSnooze.objects.filter(Q(user_id=user.id) | Q(user_id=None), rule=obj)
185         if rule_snooze.exists():
186             d["snooze"] = True
187             snooze = rule_snooze[0]
188             if user.id == snooze.owner_id:
189                 created_by = "You"
190             else:
191                 creator_name = user_service.get_user(snooze.owner_id).get_display_name()
192                 created_by = creator_name
193             d["snoozeCreatedBy"] = created_by
194             d["snoozeForEveryone"] = snooze.user_id is None
195         else:
196             d["snooze"] = False
197 
198         return d
199
```
--- 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/api/serializers/models/rule.py b/src/sentry/api/serializers/models/rule.py
--- a/src/sentry/api/serializers/models/rule.py
+++ b/src/sentry/api/serializers/models/rule.py
@@ -15,6 +15,7 @@
     actor_type_to_string,
 )
 from sentry.models.actor import Actor
+from sentry.models.rule import NeglectedRule
 from sentry.models.rulefirehistory import RuleFireHistory
 from sentry.models.rulesnooze import RuleSnooze
 from sentry.services.hybrid_cloud.user.service import user_service
@@ -195,4 +196,13 @@
         else:
             d["snooze"] = False
 
+        try:
+            neglected_rule = NeglectedRule.objects.get(
+                rule=obj, organization=obj.project.organization_id, opted_out=False
+            )
+            d["disableReason"] = "noisy"
+            d["disableDate"] = neglected_rule.disable_date
+        except (NeglectedRule.DoesNotExist, NeglectedRule.MultipleObjectsReturned):
+            pass
+
         return d

{"golden_diff": "diff --git a/src/sentry/api/serializers/models/rule.py b/src/sentry/api/serializers/models/rule.py\n--- a/src/sentry/api/serializers/models/rule.py\n+++ b/src/sentry/api/serializers/models/rule.py\n@@ -15,6 +15,7 @@\n     actor_type_to_string,\n )\n from sentry.models.actor import Actor\n+from sentry.models.rule import NeglectedRule\n from sentry.models.rulefirehistory import RuleFireHistory\n from sentry.models.rulesnooze import RuleSnooze\n from sentry.services.hybrid_cloud.user.service import user_service\n@@ -195,4 +196,13 @@\n         else:\n             d[\"snooze\"] = False\n \n+        try:\n+            neglected_rule = NeglectedRule.objects.get(\n+                rule=obj, organization=obj.project.organization_id, opted_out=False\n+            )\n+            d[\"disableReason\"] = \"noisy\"\n+            d[\"disableDate\"] = neglected_rule.disable_date\n+        except (NeglectedRule.DoesNotExist, NeglectedRule.MultipleObjectsReturned):\n+            pass\n+\n         return d\n", "issue": "[BE] Update the alerts response to include whether the alert was disabled due to being \u201cnoisy\u201d\nSimilar to https://github.com/getsentry/sentry/issues/55098 - update the response to include something like `disableReason: noisy` if a `NoisyIssueAlert` entry exists for that rule id. Also need to add a `noisyDisableDate` so the front end can know whether or not to display the banner. \n", "before_files": [{"content": "from collections import defaultdict\nfrom typing import List\n\nfrom django.db.models import Max, Q, prefetch_related_objects\nfrom rest_framework import serializers\n\nfrom sentry.api.serializers import Serializer, register\nfrom sentry.constants import ObjectStatus\nfrom sentry.models import (\n    ACTOR_TYPES,\n    Environment,\n    Rule,\n    RuleActivity,\n    RuleActivityType,\n    actor_type_to_string,\n)\nfrom sentry.models.actor import Actor\nfrom sentry.models.rulefirehistory import RuleFireHistory\nfrom sentry.models.rulesnooze import RuleSnooze\nfrom sentry.services.hybrid_cloud.user.service import user_service\n\n\ndef _generate_rule_label(project, rule, data):\n    from sentry.rules import rules\n\n    rule_cls = rules.get(data[\"id\"])\n    if rule_cls is None:\n        return\n\n    rule_inst = rule_cls(project, data=data, rule=rule)\n    return rule_inst.render_label()\n\n\ndef _is_filter(data):\n    from sentry.rules import rules\n\n    rule_cls = rules.get(data[\"id\"])\n    return rule_cls.rule_type == \"filter/event\"\n\n\n@register(Rule)\nclass RuleSerializer(Serializer):\n    def __init__(self, expand=None):\n        super().__init__()\n        self.expand = expand or []\n\n    def get_attrs(self, item_list, user, **kwargs):\n        from sentry.services.hybrid_cloud.app import app_service\n\n        prefetch_related_objects(item_list, \"project\")\n\n        environments = Environment.objects.in_bulk(\n            [_f for _f in [i.environment_id for i in item_list] if _f]\n        )\n\n        result = {i: {\"environment\": environments.get(i.environment_id)} for i in item_list}\n        ras = list(\n            RuleActivity.objects.filter(\n                rule__in=item_list, type=RuleActivityType.CREATED.value\n            ).select_related(\"rule\")\n        )\n\n        users = {\n            u.id: u for u in user_service.get_many(filter=dict(user_ids=[ra.user_id for ra in ras]))\n        }\n\n        for rule_activity in ras:\n            u = users.get(rule_activity.user_id)\n            if u:\n                user = {\n                    \"id\": u.id,\n                    \"name\": u.get_display_name(),\n                    \"email\": u.email,\n                }\n            else:\n                user = None\n\n            result[rule_activity.rule].update({\"created_by\": user})\n\n        rules = {item.id: item for item in item_list}\n        resolved_actors = {}\n        owners_by_type = defaultdict(list)\n\n        sentry_app_uuids = [\n            sentry_app_uuid\n            for sentry_app_uuid in (\n                action.get(\"sentryAppInstallationUuid\")\n                for rule in rules.values()\n                for action in rule.data.get(\"actions\", [])\n            )\n            if sentry_app_uuid is not None\n        ]\n\n        sentry_app_ids: List[int] = [\n            i.sentry_app.id for i in app_service.get_many(filter=dict(uuids=sentry_app_uuids))\n        ]\n        sentry_app_installations_by_uuid = app_service.get_related_sentry_app_components(\n            organization_ids=[rule.project.organization_id for rule in rules.values()],\n            sentry_app_ids=sentry_app_ids,\n            type=\"alert-rule-action\",\n            group_by=\"uuid\",\n        )\n\n        for item in item_list:\n            if item.owner_id is not None:\n                owners_by_type[actor_type_to_string(item.owner.type)].append(item.owner_id)\n\n        for k, v in ACTOR_TYPES.items():\n            actors = Actor.objects.filter(type=v, id__in=owners_by_type[k])\n            if k == \"team\":\n                resolved_actors[k] = {actor.id: actor.team_id for actor in actors}\n            if k == \"user\":\n                resolved_actors[k] = {actor.id: actor.user_id for actor in actors}\n\n        for rule in rules.values():\n            if rule.owner_id:\n                type = actor_type_to_string(rule.owner.type)\n                if rule.owner_id in resolved_actors[type]:\n                    result[rule][\"owner\"] = f\"{type}:{resolved_actors[type][rule.owner_id]}\"\n\n            for action in rule.data.get(\"actions\", []):\n                install = sentry_app_installations_by_uuid.get(\n                    str(action.get(\"sentryAppInstallationUuid\"))\n                )\n                if install:\n                    action[\"_sentry_app_component\"] = install.get(\"sentry_app_component\")\n                    action[\"_sentry_app_installation\"] = install.get(\"sentry_app_installation\")\n\n        if \"lastTriggered\" in self.expand:\n            last_triggered_lookup = {\n                rfh[\"rule_id\"]: rfh[\"date_added\"]\n                for rfh in RuleFireHistory.objects.filter(rule__in=item_list)\n                .values(\"rule_id\")\n                .annotate(date_added=Max(\"date_added\"))\n            }\n            for rule in item_list:\n                result[rule][\"last_triggered\"] = last_triggered_lookup.get(rule.id, None)\n\n        return result\n\n    def serialize(self, obj, attrs, user, **kwargs):\n        environment = attrs[\"environment\"]\n        all_conditions = [\n            dict(list(o.items()) + [(\"name\", _generate_rule_label(obj.project, obj, o))])\n            for o in obj.data.get(\"conditions\", [])\n        ]\n\n        actions = []\n        for action in obj.data.get(\"actions\", []):\n            try:\n                actions.append(\n                    dict(\n                        list(action.items())\n                        + [(\"name\", _generate_rule_label(obj.project, obj, action))]\n                    )\n                )\n            except serializers.ValidationError:\n                # Integrations can be deleted and we don't want to fail to load the rule\n                pass\n\n        d = {\n            # XXX(dcramer): we currently serialize unsaved rule objects\n            # as part of the rule editor\n            \"id\": str(obj.id) if obj.id else None,\n            # conditions pertain to criteria that can trigger an alert\n            \"conditions\": list(filter(lambda condition: not _is_filter(condition), all_conditions)),\n            # filters are not new conditions but are the subset of conditions that pertain to event attributes\n            \"filters\": list(filter(lambda condition: _is_filter(condition), all_conditions)),\n            \"actions\": actions,\n            \"actionMatch\": obj.data.get(\"action_match\") or Rule.DEFAULT_CONDITION_MATCH,\n            \"filterMatch\": obj.data.get(\"filter_match\") or Rule.DEFAULT_FILTER_MATCH,\n            \"frequency\": obj.data.get(\"frequency\") or Rule.DEFAULT_FREQUENCY,\n            \"name\": obj.label,\n            \"dateCreated\": obj.date_added,\n            \"owner\": attrs.get(\"owner\", None),\n            \"createdBy\": attrs.get(\"created_by\", None),\n            \"environment\": environment.name if environment is not None else None,\n            \"projects\": [obj.project.slug],\n            \"status\": \"active\" if obj.status == ObjectStatus.ACTIVE else \"disabled\",\n        }\n        if \"last_triggered\" in attrs:\n            d[\"lastTriggered\"] = attrs[\"last_triggered\"]\n\n        rule_snooze = RuleSnooze.objects.filter(Q(user_id=user.id) | Q(user_id=None), rule=obj)\n        if rule_snooze.exists():\n            d[\"snooze\"] = True\n            snooze = rule_snooze[0]\n            if user.id == snooze.owner_id:\n                created_by = \"You\"\n            else:\n                creator_name = user_service.get_user(snooze.owner_id).get_display_name()\n                created_by = creator_name\n            d[\"snoozeCreatedBy\"] = created_by\n            d[\"snoozeForEveryone\"] = snooze.user_id is None\n        else:\n            d[\"snooze\"] = False\n\n        return d\n", "path": "src/sentry/api/serializers/models/rule.py"}], "after_files": [{"content": "from collections import defaultdict\nfrom typing import List\n\nfrom django.db.models import Max, Q, prefetch_related_objects\nfrom rest_framework import serializers\n\nfrom sentry.api.serializers import Serializer, register\nfrom sentry.constants import ObjectStatus\nfrom sentry.models import (\n    ACTOR_TYPES,\n    Environment,\n    Rule,\n    RuleActivity,\n    RuleActivityType,\n    actor_type_to_string,\n)\nfrom sentry.models.actor import Actor\nfrom sentry.models.rule import NeglectedRule\nfrom sentry.models.rulefirehistory import RuleFireHistory\nfrom sentry.models.rulesnooze import RuleSnooze\nfrom sentry.services.hybrid_cloud.user.service import user_service\n\n\ndef _generate_rule_label(project, rule, data):\n    from sentry.rules import rules\n\n    rule_cls = rules.get(data[\"id\"])\n    if rule_cls is None:\n        return\n\n    rule_inst = rule_cls(project, data=data, rule=rule)\n    return rule_inst.render_label()\n\n\ndef _is_filter(data):\n    from sentry.rules import rules\n\n    rule_cls = rules.get(data[\"id\"])\n    return rule_cls.rule_type == \"filter/event\"\n\n\n@register(Rule)\nclass RuleSerializer(Serializer):\n    def __init__(self, expand=None):\n        super().__init__()\n        self.expand = expand or []\n\n    def get_attrs(self, item_list, user, **kwargs):\n        from sentry.services.hybrid_cloud.app import app_service\n\n        prefetch_related_objects(item_list, \"project\")\n\n        environments = Environment.objects.in_bulk(\n            [_f for _f in [i.environment_id for i in item_list] if _f]\n        )\n\n        result = {i: {\"environment\": environments.get(i.environment_id)} for i in item_list}\n        ras = list(\n            RuleActivity.objects.filter(\n                rule__in=item_list, type=RuleActivityType.CREATED.value\n            ).select_related(\"rule\")\n        )\n\n        users = {\n            u.id: u for u in user_service.get_many(filter=dict(user_ids=[ra.user_id for ra in ras]))\n        }\n\n        for rule_activity in ras:\n            u = users.get(rule_activity.user_id)\n            if u:\n                user = {\n                    \"id\": u.id,\n                    \"name\": u.get_display_name(),\n                    \"email\": u.email,\n                }\n            else:\n                user = None\n\n            result[rule_activity.rule].update({\"created_by\": user})\n\n        rules = {item.id: item for item in item_list}\n        resolved_actors = {}\n        owners_by_type = defaultdict(list)\n\n        sentry_app_uuids = [\n            sentry_app_uuid\n            for sentry_app_uuid in (\n                action.get(\"sentryAppInstallationUuid\")\n                for rule in rules.values()\n                for action in rule.data.get(\"actions\", [])\n            )\n            if sentry_app_uuid is not None\n        ]\n\n        sentry_app_ids: List[int] = [\n            i.sentry_app.id for i in app_service.get_many(filter=dict(uuids=sentry_app_uuids))\n        ]\n        sentry_app_installations_by_uuid = app_service.get_related_sentry_app_components(\n            organization_ids=[rule.project.organization_id for rule in rules.values()],\n            sentry_app_ids=sentry_app_ids,\n            type=\"alert-rule-action\",\n            group_by=\"uuid\",\n        )\n\n        for item in item_list:\n            if item.owner_id is not None:\n                owners_by_type[actor_type_to_string(item.owner.type)].append(item.owner_id)\n\n        for k, v in ACTOR_TYPES.items():\n            actors = Actor.objects.filter(type=v, id__in=owners_by_type[k])\n            if k == \"team\":\n                resolved_actors[k] = {actor.id: actor.team_id for actor in actors}\n            if k == \"user\":\n                resolved_actors[k] = {actor.id: actor.user_id for actor in actors}\n\n        for rule in rules.values():\n            if rule.owner_id:\n                type = actor_type_to_string(rule.owner.type)\n                if rule.owner_id in resolved_actors[type]:\n                    result[rule][\"owner\"] = f\"{type}:{resolved_actors[type][rule.owner_id]}\"\n\n            for action in rule.data.get(\"actions\", []):\n                install = sentry_app_installations_by_uuid.get(\n                    str(action.get(\"sentryAppInstallationUuid\"))\n                )\n                if install:\n                    action[\"_sentry_app_component\"] = install.get(\"sentry_app_component\")\n                    action[\"_sentry_app_installation\"] = install.get(\"sentry_app_installation\")\n\n        if \"lastTriggered\" in self.expand:\n            last_triggered_lookup = {\n                rfh[\"rule_id\"]: rfh[\"date_added\"]\n                for rfh in RuleFireHistory.objects.filter(rule__in=item_list)\n                .values(\"rule_id\")\n                .annotate(date_added=Max(\"date_added\"))\n            }\n            for rule in item_list:\n                result[rule][\"last_triggered\"] = last_triggered_lookup.get(rule.id, None)\n\n        return result\n\n    def serialize(self, obj, attrs, user, **kwargs):\n        environment = attrs[\"environment\"]\n        all_conditions = [\n            dict(list(o.items()) + [(\"name\", _generate_rule_label(obj.project, obj, o))])\n            for o in obj.data.get(\"conditions\", [])\n        ]\n\n        actions = []\n        for action in obj.data.get(\"actions\", []):\n            try:\n                actions.append(\n                    dict(\n                        list(action.items())\n                        + [(\"name\", _generate_rule_label(obj.project, obj, action))]\n                    )\n                )\n            except serializers.ValidationError:\n                # Integrations can be deleted and we don't want to fail to load the rule\n                pass\n\n        d = {\n            # XXX(dcramer): we currently serialize unsaved rule objects\n            # as part of the rule editor\n            \"id\": str(obj.id) if obj.id else None,\n            # conditions pertain to criteria that can trigger an alert\n            \"conditions\": list(filter(lambda condition: not _is_filter(condition), all_conditions)),\n            # filters are not new conditions but are the subset of conditions that pertain to event attributes\n            \"filters\": list(filter(lambda condition: _is_filter(condition), all_conditions)),\n            \"actions\": actions,\n            \"actionMatch\": obj.data.get(\"action_match\") or Rule.DEFAULT_CONDITION_MATCH,\n            \"filterMatch\": obj.data.get(\"filter_match\") or Rule.DEFAULT_FILTER_MATCH,\n            \"frequency\": obj.data.get(\"frequency\") or Rule.DEFAULT_FREQUENCY,\n            \"name\": obj.label,\n            \"dateCreated\": obj.date_added,\n            \"owner\": attrs.get(\"owner\", None),\n            \"createdBy\": attrs.get(\"created_by\", None),\n            \"environment\": environment.name if environment is not None else None,\n            \"projects\": [obj.project.slug],\n            \"status\": \"active\" if obj.status == ObjectStatus.ACTIVE else \"disabled\",\n        }\n        if \"last_triggered\" in attrs:\n            d[\"lastTriggered\"] = attrs[\"last_triggered\"]\n\n        rule_snooze = RuleSnooze.objects.filter(Q(user_id=user.id) | Q(user_id=None), rule=obj)\n        if rule_snooze.exists():\n            d[\"snooze\"] = True\n            snooze = rule_snooze[0]\n            if user.id == snooze.owner_id:\n                created_by = \"You\"\n            else:\n                creator_name = user_service.get_user(snooze.owner_id).get_display_name()\n                created_by = creator_name\n            d[\"snoozeCreatedBy\"] = created_by\n            d[\"snoozeForEveryone\"] = snooze.user_id is None\n        else:\n            d[\"snooze\"] = False\n\n        try:\n            neglected_rule = NeglectedRule.objects.get(\n                rule=obj, organization=obj.project.organization_id, opted_out=False\n            )\n            d[\"disableReason\"] = \"noisy\"\n            d[\"disableDate\"] = neglected_rule.disable_date\n        except (NeglectedRule.DoesNotExist, NeglectedRule.MultipleObjectsReturned):\n            pass\n\n        return d\n", "path": "src/sentry/api/serializers/models/rule.py"}]}