Update `owners` method and add `direct_owners` method
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
- Modifies the ProjectTeam
Screenshots or screen recordings
No UI changes
How to set up and validate locally
- Create (or find) a project within a subgroup. Ensure the parent group has at least one owner
user1
, the subgroup has one owneruser2
and the project has one owneruser3
. - In console, retrieve the project and call
owners
.p = Project.find(1) owners = Project.owners => [`user2`]
- Enable the feature flag
Feature.enable(:direct_project_owners)
- Reload the project and call
owners
againp = 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.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #365459
Edited by charlie ablett