2018-09-26 03:45:43 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-04-03 20:00:51 +00:00
|
|
|
class Projects::ProtectedBranchesController < Projects::ProtectedRefsController
|
|
|
|
protected
|
2012-02-15 21:51:04 +00:00
|
|
|
|
2017-04-03 20:00:51 +00:00
|
|
|
def project_refs
|
|
|
|
@project.repository.branches
|
2014-12-26 10:39:12 +00:00
|
|
|
end
|
|
|
|
|
2018-03-24 11:05:04 +00:00
|
|
|
def service_namespace
|
|
|
|
::ProtectedBranches
|
2017-04-03 20:00:51 +00:00
|
|
|
end
|
2014-06-26 12:00:09 +00:00
|
|
|
|
2017-04-03 20:00:51 +00:00
|
|
|
def load_protected_ref
|
2017-04-05 17:59:46 +00:00
|
|
|
@protected_ref = @project.protected_branches.find(params[:id])
|
2016-06-16 07:33:30 +00:00
|
|
|
end
|
|
|
|
|
2018-12-17 18:05:08 +00:00
|
|
|
def access_levels
|
|
|
|
[:merge_access_levels, :push_access_levels]
|
|
|
|
end
|
|
|
|
|
2019-10-09 00:06:06 +00:00
|
|
|
def protected_ref_params(*attrs)
|
|
|
|
attrs = ([:name,
|
|
|
|
merge_access_levels_attributes: access_level_attributes,
|
|
|
|
push_access_levels_attributes: access_level_attributes] + attrs).uniq
|
|
|
|
|
|
|
|
params.require(:protected_branch).permit(attrs)
|
2014-06-26 12:00:09 +00:00
|
|
|
end
|
2012-02-15 20:02:33 +00:00
|
|
|
end
|
2019-10-09 00:06:06 +00:00
|
|
|
|
|
|
|
Projects::ProtectedBranchesController.prepend_if_ee('EE::Projects::ProtectedBranchesController')
|