Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-07-14 00:10:15 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-07-14 00:10:15 +0300
commita269fb8e7cca24b826dd3f53485641ffce93bbee (patch)
tree81a7c4f56feba26bb6244c8a3a76123533f68aa8 /app/services/protected_branches
parent7e064974b92de60a3ef4642905e8af98a364a7a0 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/protected_branches')
-rw-r--r--app/services/protected_branches/access_level_params.rb37
-rw-r--r--app/services/protected_branches/api_service.rb4
2 files changed, 2 insertions, 39 deletions
diff --git a/app/services/protected_branches/access_level_params.rb b/app/services/protected_branches/access_level_params.rb
deleted file mode 100644
index 6f7a289d9b4..00000000000
--- a/app/services/protected_branches/access_level_params.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-# frozen_string_literal: true
-
-module ProtectedBranches
- class AccessLevelParams
- attr_reader :type, :params
-
- def initialize(type, params)
- @type = type
- @params = params_with_default(params)
- end
-
- def access_levels
- ce_style_access_level
- end
-
- private
-
- def params_with_default(params)
- params[:"#{type}_access_level"] ||= Gitlab::Access::MAINTAINER if use_default_access_level?(params)
- params
- end
-
- def use_default_access_level?(params)
- true
- end
-
- def ce_style_access_level
- access_level = params[:"#{type}_access_level"]
-
- return [] unless access_level
-
- [{ access_level: access_level }]
- end
- end
-end
-
-ProtectedBranches::AccessLevelParams.prepend_mod_with('ProtectedBranches::AccessLevelParams')
diff --git a/app/services/protected_branches/api_service.rb b/app/services/protected_branches/api_service.rb
index d0d0737fd66..f604a57bcd1 100644
--- a/app/services/protected_branches/api_service.rb
+++ b/app/services/protected_branches/api_service.rb
@@ -10,8 +10,8 @@ module ProtectedBranches
{
name: params[:name],
allow_force_push: allow_force_push?,
- push_access_levels_attributes: AccessLevelParams.new(:push, params).access_levels,
- merge_access_levels_attributes: AccessLevelParams.new(:merge, params).access_levels
+ push_access_levels_attributes: ::ProtectedRefs::AccessLevelParams.new(:push, params).access_levels,
+ merge_access_levels_attributes: ::ProtectedRefs::AccessLevelParams.new(:merge, params).access_levels
}
end