diff options
author | Nick Thomas <nick@gitlab.com> | 2018-03-27 14:31:54 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2018-03-27 14:31:54 +0000 |
commit | 96b355dca025ed2d85784bd73a9ff9d838181a3f (patch) | |
tree | 1d6da87c606e498d2733a57aedfed00767abc655 /app/controllers | |
parent | fbb727db3e72619044c23cf898b72a4dc85d3af2 (diff) | |
parent | 48717b434d583a0be1f22803edd6948c13e11591 (diff) | |
download | gitlab-ce-96b355dca025ed2d85784bd73a9ff9d838181a3f.tar.gz |
Merge branch 'jej/add-protected-branch-policy' into 'master'
Add protected branch policy
See merge request gitlab-org/gitlab-ce!17982
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/projects/protected_branches_controller.rb | 8 | ||||
-rw-r--r-- | app/controllers/projects/protected_refs_controller.rb | 14 | ||||
-rw-r--r-- | app/controllers/projects/protected_tags_controller.rb | 8 |
3 files changed, 17 insertions, 13 deletions
diff --git a/app/controllers/projects/protected_branches_controller.rb b/app/controllers/projects/protected_branches_controller.rb index d1719f12072..64954ac9a42 100644 --- a/app/controllers/projects/protected_branches_controller.rb +++ b/app/controllers/projects/protected_branches_controller.rb @@ -5,12 +5,8 @@ class Projects::ProtectedBranchesController < Projects::ProtectedRefsController @project.repository.branches end - def create_service_class - ::ProtectedBranches::CreateService - end - - def update_service_class - ::ProtectedBranches::UpdateService + def service_namespace + ::ProtectedBranches end def load_protected_ref diff --git a/app/controllers/projects/protected_refs_controller.rb b/app/controllers/projects/protected_refs_controller.rb index b51bdf7aa78..9e757a8d25f 100644 --- a/app/controllers/projects/protected_refs_controller.rb +++ b/app/controllers/projects/protected_refs_controller.rb @@ -37,7 +37,7 @@ class Projects::ProtectedRefsController < Projects::ApplicationController end def destroy - @protected_ref.destroy + destroy_service_class.new(@project, current_user).execute(@protected_ref) respond_to do |format| format.html { redirect_to_repository_settings(@project) } @@ -47,6 +47,18 @@ class Projects::ProtectedRefsController < Projects::ApplicationController protected + def create_service_class + service_namespace::CreateService + end + + def update_service_class + service_namespace::UpdateService + end + + def destroy_service_class + service_namespace::DestroyService + end + def access_level_attributes %i(access_level id) end diff --git a/app/controllers/projects/protected_tags_controller.rb b/app/controllers/projects/protected_tags_controller.rb index a5dbd7e46ae..198c938ff35 100644 --- a/app/controllers/projects/protected_tags_controller.rb +++ b/app/controllers/projects/protected_tags_controller.rb @@ -5,12 +5,8 @@ class Projects::ProtectedTagsController < Projects::ProtectedRefsController @project.repository.tags end - def create_service_class - ::ProtectedTags::CreateService - end - - def update_service_class - ::ProtectedTags::UpdateService + def service_namespace + ::ProtectedTags end def load_protected_ref |