2018-09-25 23:45:43 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-04-03 16:00:51 -04:00
|
|
|
class Projects::ProtectedBranchesController < Projects::ProtectedRefsController
|
|
|
|
protected
|
2012-02-15 16:51:04 -05:00
|
|
|
|
2017-04-03 16:00:51 -04:00
|
|
|
def project_refs
|
|
|
|
@project.repository.branches
|
2014-12-26 05:39:12 -05:00
|
|
|
end
|
|
|
|
|
2018-03-24 07:05:04 -04:00
|
|
|
def service_namespace
|
|
|
|
::ProtectedBranches
|
2017-04-03 16:00:51 -04:00
|
|
|
end
|
2014-06-26 08:00:09 -04:00
|
|
|
|
2017-04-03 16:00:51 -04:00
|
|
|
def load_protected_ref
|
2017-04-05 13:59:46 -04:00
|
|
|
@protected_ref = @project.protected_branches.find(params[:id])
|
2016-06-16 03:33:30 -04:00
|
|
|
end
|
|
|
|
|
2018-12-17 13:05:08 -05:00
|
|
|
def access_levels
|
|
|
|
[:merge_access_levels, :push_access_levels]
|
|
|
|
end
|
|
|
|
|
2019-10-08 20:06:06 -04: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 08:00:09 -04:00
|
|
|
end
|
2012-02-15 15:02:33 -05:00
|
|
|
end
|
2019-10-08 20:06:06 -04:00
|
|
|
|
|
|
|
Projects::ProtectedBranchesController.prepend_if_ee('EE::Projects::ProtectedBranchesController')
|