Skip to content

Commit 0cc3e77

Browse files
ref: handle nullability of Activity.data in serializer (#97478)
<!-- Describe your PR here. -->
1 parent f3cd9c3 commit 0cc3e77

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/sentry/api/serializers/models/activity.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def get_attrs(self, item_list, user, **kwargs):
121121
for item in item_list
122122
}
123123

124-
def serialize(self, obj, attrs, user, **kwargs):
124+
def serialize(self, obj: Activity, attrs, user, **kwargs):
125125
if obj.type == ActivityType.SET_RESOLVED_IN_COMMIT.value:
126126
data = {"commit": attrs["commit"]}
127127
elif obj.type == ActivityType.SET_RESOLVED_IN_PULL_REQUEST.value:
@@ -131,7 +131,7 @@ def serialize(self, obj, attrs, user, **kwargs):
131131
elif obj.type == ActivityType.UNMERGE_SOURCE.value:
132132
data = {"fingerprints": obj.data["fingerprints"], "destination": attrs["destination"]}
133133
else:
134-
data = obj.data
134+
data = obj.data or {}
135135
# XXX: We had a problem where Users were embedded into the mentions
136136
# attribute of group notes which needs to be removed
137137
# While group_note update has been fixed there are still many skunky comments

0 commit comments

Comments
 (0)