diff options
Diffstat (limited to 'app/services/protected_branches/api_service.rb')
-rw-r--r-- | app/services/protected_branches/api_service.rb | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/app/services/protected_branches/api_service.rb b/app/services/protected_branches/api_service.rb index 9b85e13107b..1b13dace5f2 100644 --- a/app/services/protected_branches/api_service.rb +++ b/app/services/protected_branches/api_service.rb @@ -3,16 +3,15 @@ module ProtectedBranches class ApiService < BaseService def create - @push_params = AccessLevelParams.new(:push, params) - @merge_params = AccessLevelParams.new(:merge, params) + ::ProtectedBranches::CreateService.new(@project, @current_user, protected_branch_params).execute + end - protected_branch_params = { + def protected_branch_params + { name: params[:name], - push_access_levels_attributes: @push_params.access_levels, - merge_access_levels_attributes: @merge_params.access_levels + push_access_levels_attributes: AccessLevelParams.new(:push, params).access_levels, + merge_access_levels_attributes: AccessLevelParams.new(:merge, params).access_levels } - - ::ProtectedBranches::CreateService.new(@project, @current_user, protected_branch_params).execute end end end |