Skip to content

fix(issue-views): Fix endpoint sorting by last_visited to query for specific user #89960

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

malwilley
Copy link
Member

@malwilley malwilley commented Apr 18, 2025

The "Last Visited" sort was acting very strangely, returning the wrong order and in some cases duplicate records. This was because the sort was pointing at the GroupSearchViewLastVisited model, but did not do any querying for the specific user.

Added a last_visited annotation that makes the correct query to fix this.

@malwilley malwilley requested review from a team as code owners April 18, 2025 23:08
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 18, 2025
GroupSearchViewLastVisited.objects.create(
user_id=user.id,
GroupSearchViewLastVisited.objects.create_or_update(
user_id=self.user.id,
Copy link
Member Author

Choose a reason for hiding this comment

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

The test util was attributing last_visited to the incoming user instead of the current user, which was what hid this error and caused the tests to pass.

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