diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2016-07-08 12:15:29 +0300 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2016-07-29 12:50:39 +0300 |
commit | a9958ddc7c9d4c455d4c5459b7b83da1fab9ccb4 (patch) | |
tree | fe06e515925aa454428327504c7c441f1465bb4c /app/services/git_push_service.rb | |
parent | 9fa661472e5e1e2edc91032a6093a3516974e27e (diff) |
Fix default branch protection.
1. So it works with the new data model for protected branch access levels.
Diffstat (limited to 'app/services/git_push_service.rb')
-rw-r--r-- | app/services/git_push_service.rb | 8 |
1 files changed, 5 insertions, 3 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 |