Draft: Resolve "Group-level protected branches - Backend create and show"
What does this MR do and why?
Closes #1188 (closed)
-
Update ProtectedBranchPolicy
to handle both projects as well as groups. -
Create Groups::ProtectedBranchesController
similar toProjects::ProtectedBranchesController
. This will be used by frontend to create new protected branches for a group. -
Update Groups::Settings::RepositoryController
and create an instance variable like@protected_branches = @group.protected_branches.order(:name).page(params[:page])
. This will be used by the frontend to list the protected branches on the group settings page. -
Update the show
method ofProjects::Settings::RepositoryController
to return@protected_branches
as well as@protected_group_branches
where@protected_group_branches = @project.root_namespace.protected_branches.order(:name).page(params[:page])
. Frontend can use the new variable@protected_group_branches
to distinguish the protected branches defined at the group level and mark them as locked as per the UI. This should be behind a feature flag. -
Add these helper methods to the projects
model so that it can be used at other places.def group_protected_branches root_namespace.protected_branches end def all_protected_branches protected_branches + group_protected_branches end
-
Find and update the usage of project.protected_branches
withproject.all_branches
at the required places in the codebase. This should be behind a feature flag. -
FF group_protected_branches
-
GitLab Premium License