Skip to content

Update `owners` method and add `direct_owners` method

charlie ablett requested to merge 365459-cablett-project-owners-method into master

What does this MR do and why?

Split off from !90365 (closed).

ProjectTeam owners method currently returns:

  • Owner members of the parent group, but none of the direct Project owners
  • Does not filter by active - includes blocked users

This MR does the following:

  • Adds a direct_owners method in Project which returns only active users that are direct Owner members of the project
  • if direct_project_owners feature flag is enabled:
    • Modifies the ProjectTeam owners method to also return direct project owners
    • Filters parent group members to exclude blocked owners

Screenshots or screen recordings

No UI changes

How to set up and validate locally

  1. Create (or find) a project within a subgroup. Ensure the parent group has at least one owner user1, the subgroup has one owner user2 and the project has one owner user3.
  2. In console, retrieve the project and call owners.
    p = Project.find(1)
    owners = Project.owners
    => [`user2`]
  3. Enable the feature flag
    Feature.enable(:direct_project_owners)
  4. Reload the project and call owners again
    p = Project.find(1)
    owners = Project.owners
    => [`user2`, `user3`]

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 #365459

Edited by charlie ablett

Merge request reports