Skip to content

Improve query in Projects::ParticipantsService

What does this MR do and why?

Instead of querying for the different types of project members we can just use the authorized_projects table.

This fixes a case where invited group members of an invited group were not included in the list.

Query changes

Before, we had to do 2 queries to fetch the members. Invited groups had to be plucked here first: https://gitlab.com/gitlab-org/gitlab/-/blob/837b7c68aaecf4b808d493a8bf08aab00ccb20f0/app/services/projects/participants_service.rb#L43

New query: https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/20465/commands/67011

How to set up and validate locally

  1. Create group1 and add user1 as a member
  2. Create group2 and invite group1 as a member
  3. Create project1 and invite group2 as a member
  4. In an issue under project1, type @ to load the user autocomplete. user1 should be included in the list.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #417757 (closed)

Edited by Heinrich Lee Yu

Merge request reports

Loading