diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-20 12:16:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-20 12:16:11 +0300 |
commit | edaa33dee2ff2f7ea3fac488d41558eb5f86d68c (patch) | |
tree | 11f143effbfeba52329fb7afbd05e6e2a3790241 /app/models/protectable_dropdown.rb | |
parent | d8a5691316400a0f7ec4f83832698f1988eb27c1 (diff) |
Add latest changes from gitlab-org/gitlab@14-7-stable-eev14.7.0-rc42
Diffstat (limited to 'app/models/protectable_dropdown.rb')
-rw-r--r-- | app/models/protectable_dropdown.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/app/models/protectable_dropdown.rb b/app/models/protectable_dropdown.rb index e1336be9528..855876f2ec9 100644 --- a/app/models/protectable_dropdown.rb +++ b/app/models/protectable_dropdown.rb @@ -2,6 +2,10 @@ class ProtectableDropdown REF_TYPES = %i[branches tags].freeze + REF_NAME_METHODS = { + branches: :branch_names, + tags: :tag_names + }.freeze def initialize(project, ref_type) raise ArgumentError, "invalid ref type `#{ref_type}`" unless ref_type.in?(REF_TYPES) @@ -23,12 +27,12 @@ class ProtectableDropdown private - def refs - @project.repository.public_send(@ref_type) # rubocop:disable GitlabSecurity/PublicSend + def ref_names + @project.repository.public_send(ref_name_method) # rubocop:disable GitlabSecurity/PublicSend end - def ref_names - refs.map(&:name) + def ref_name_method + REF_NAME_METHODS[@ref_type] end def protections |