Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(shared-views): Remove position usage in groupsearchview serializer #87367

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MichaelSun48
Copy link
Member

Fixes SENTRY-3QBN

Clone of #87297, but includes a fix in ed8c6fc that was causing some json serialization issues shown in the Sentry error above.

@MichaelSun48 MichaelSun48 requested a review from a team as a code owner March 18, 2025 23:23
user_id=request.user.id,
group_search_view_id__in=[view.id for view in new_view_state],
)
last_visited_map = {lv.group_search_view_id: lv.last_visited for lv in last_visited_views}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line was the issue: I was sending over an entire GroupSearchViewLastVisited entry rather than just the last_visited timestamp, which was causing the serializability error.

Comment on lines +288 to +303
@with_feature({"organizations:issue-stream-custom-views": True})
@with_feature({"organizations:global-views": True})
@freeze_time("2025-03-07T00:00:00Z")
def test_response_with_last_visited(self) -> None:
GroupSearchViewLastVisited.objects.create(
user_id=self.user.id,
organization=self.organization,
group_search_view=self.base_data["user_one_views"][0],
last_visited=timezone.now(),
)

views = self.client.get(self.url).data
response = self.get_success_response(self.organization.slug, views=views)

assert response.data[0]["lastVisited"] == timezone.now()
assert response.data[1]["lastVisited"] is None
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test correctly reproduced the error and now passes with the fix.

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant