Skip to content

Fix N+1 when looking up user's solo owned groups

Catalin Irimie requested to merge cat-fix-nplus1-solo-owned-groups into master

What does this MR do?

Before this change, the solo_owned_groups lookup would generate additional queries for each group owned by the user, and is used in can_be_removed? user checks and profile view pages.

This preloads the owners for Groups to prevent the additional N+1 queries.

Related to #287618 (closed)

Screenshots (strongly suggested)

Before:

image

After:

image

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Merge request reports

Loading