blob: ab462f3054ebe139703ca6893c1f24568b30f982 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
module ProtectedBranches
class 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
end
|