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

fix: Remove ordering on account organizations list #900

Merged
merged 4 commits into from
Oct 18, 2024

Conversation

spalmurray-codecov
Copy link
Contributor

Removes the ordering argument on the account organizations list because it turns out that the paginator can't handle/isn't intended to do sorting by count of a field. Was throwing errors.

Additionally, adds a new resolver decorator to allow users of an account to see the activatedUserCount of orgs in that same account. This was a necessary change to support the desired UI, otherwise we'd only show activated user counts for orgs that the user is a member of.

…ee activatedUserCount on that account's orgs
@spalmurray-codecov spalmurray-codecov marked this pull request as ready for review October 17, 2024 15:38
@spalmurray-codecov spalmurray-codecov requested a review from a team as a code owner October 17, 2024 15:38
@codecov-notifications
Copy link

codecov-notifications bot commented Oct 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

and current_user.is_authenticated
and queried_owner
and queried_owner.account
and current_user in queried_owner.account.users.all()
Copy link
Contributor

Choose a reason for hiding this comment

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

💯 💯 💯
LMK if this is being slow, can optimize with

  • a prefetch for the Account and Users objs when you hit the db for the Owner obj
  • doing current_user in queried_owner.account.users.all() in a different way

Copy link
Contributor

Choose a reason for hiding this comment

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

queried_owner is the OwnerOrg that the current_user is checking permissions for right? Not the current_user's OwnerUser object 🫠

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nora-codecov Yes. Specifically this decorator should allow users to see fields on owners they share an account with. For example, I'm in codecov org and not sentry org. Since we share an Account, this decorator will let me see certain things on Sentry that an unrelated user could not see.

Copy link
Contributor

@ajay-sentry ajay-sentry left a comment

Choose a reason for hiding this comment

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

send it!

@spalmurray-codecov spalmurray-codecov added this pull request to the merge queue Oct 18, 2024
Merged via the queue into main with commit ec56480 Oct 18, 2024
19 of 20 checks passed
@spalmurray-codecov spalmurray-codecov deleted the spalmurray/account-api-tweaks branch October 18, 2024 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants