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

create_service.rb « protected_branches « services « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 743f7bd2ce1abd129d86dbd707c06043444ae80e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class ProtectedBranches::CreateService < BaseService
  attr_reader :protected_branch

  def execute
    ProtectedBranch.transaction do
      @protected_branch = project.protected_branches.new(name: params[:name])
      @protected_branch.save!

      @protected_branch.create_push_access_level!
      @protected_branch.create_merge_access_level!

      set_access_levels!
    end

    true
  rescue ActiveRecord::RecordInvalid
    false
  end
end