diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2016-07-08 14:45:29 +0530 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2016-07-29 15:20:39 +0530 |
commit | a9958ddc7c9d4c455d4c5459b7b83da1fab9ccb4 (patch) | |
tree | fe06e515925aa454428327504c7c441f1465bb4c /app | |
parent | 9fa661472e5e1e2edc91032a6093a3516974e27e (diff) | |
download | gitlab-ce-a9958ddc7c9d4c455d4c5459b7b83da1fab9ccb4.tar.gz |
Fix default branch protection.
1. So it works with the new data model for protected branch access levels.
Diffstat (limited to 'app')
-rw-r--r-- | app/services/git_push_service.rb | 8 | ||||
-rw-r--r-- | app/services/protected_branches/create_service.rb | 2 | ||||
-rw-r--r-- | app/services/protected_branches/update_service.rb | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/app/services/git_push_service.rb b/app/services/git_push_service.rb index e02b50ff9a2..604737e6934 100644 --- a/app/services/git_push_service.rb +++ b/app/services/git_push_service.rb @@ -88,9 +88,11 @@ class GitPushService < BaseService # Set protection on the default branch if configured if current_application_settings.default_branch_protection != PROTECTION_NONE - developers_can_push = current_application_settings.default_branch_protection == PROTECTION_DEV_CAN_PUSH ? true : false - developers_can_merge = current_application_settings.default_branch_protection == PROTECTION_DEV_CAN_MERGE ? true : false - @project.protected_branches.create({ name: @project.default_branch, developers_can_push: developers_can_push, developers_can_merge: developers_can_merge }) + allowed_to_push = current_application_settings.default_branch_protection == PROTECTION_DEV_CAN_PUSH ? 'developers' : 'masters' + allowed_to_merge = current_application_settings.default_branch_protection == PROTECTION_DEV_CAN_MERGE ? 'developers' : 'masters' + + params = { name: @project.default_branch, allowed_to_push: allowed_to_push, allowed_to_merge: allowed_to_merge } + ProtectedBranches::CreateService.new(@project, current_user, params).execute end end diff --git a/app/services/protected_branches/create_service.rb b/app/services/protected_branches/create_service.rb index ab462f3054e..212c2134638 100644 --- a/app/services/protected_branches/create_service.rb +++ b/app/services/protected_branches/create_service.rb @@ -1,5 +1,5 @@ module ProtectedBranches - class CreateService < BaseService + class CreateService < ProtectedBranches::BaseService attr_reader :protected_branch def execute diff --git a/app/services/protected_branches/update_service.rb b/app/services/protected_branches/update_service.rb index ed59b06b79a..4a2b1be9c93 100644 --- a/app/services/protected_branches/update_service.rb +++ b/app/services/protected_branches/update_service.rb @@ -1,5 +1,5 @@ module ProtectedBranches - class UpdateService < BaseService + class UpdateService < ProtectedBranches::BaseService attr_reader :protected_branch def initialize(project, current_user, id, params = {}) |