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

protected_refs_helper.rb « helpers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 60f298e0e8d653aebf7a8142a13558998e1fd10b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

module ProtectedRefsHelper
  include Gitlab::Utils::StrongMemoize

  def protected_access_levels_for_dropdowns
    {
      create_access_levels: protected_access_level_dropdown_roles,
      push_access_levels: protected_access_level_dropdown_roles,
      merge_access_levels: protected_access_level_dropdown_roles
    }
  end

  def protected_access_level_dropdown_roles
    roles = ProtectedRef::AccessLevel.human_access_levels.map do |id, text|
      { id: id, text: text, before_divider: true }
    end

    { roles: roles }
  end
  strong_memoize_attr(:protected_access_level_dropdown_roles)
end