debian-mirror-gitlab/app/controllers/projects/protected_branches_controller.rb

39 lines
882 B
Ruby
Raw Normal View History

2018-12-05 23:21:45 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
class Projects::ProtectedBranchesController < Projects::ProtectedRefsController
2023-03-04 22:38:38 +05:30
def show
super
render 'protected_branches/show'
end
2017-08-17 22:00:37 +05:30
protected
2014-09-02 18:07:02 +05:30
2017-08-17 22:00:37 +05:30
def project_refs
@project.repository.branches
2015-04-26 12:48:37 +05:30
end
2018-05-09 12:01:36 +05:30
def service_namespace
::ProtectedBranches
2014-09-02 18:07:02 +05:30
end
2017-08-17 22:00:37 +05:30
def load_protected_ref
@protected_ref = @project.protected_branches.find(params[:id])
2016-08-24 12:49:21 +05:30
end
2019-02-15 15:39:39 +05:30
def access_levels
[:merge_access_levels, :push_access_levels]
end
2019-12-21 20:55:43 +05:30
def protected_ref_params(*attrs)
attrs = ([:name,
2021-04-17 20:07:23 +05:30
:allow_force_push,
2019-12-21 20:55:43 +05:30
merge_access_levels_attributes: access_level_attributes,
push_access_levels_attributes: access_level_attributes] + attrs).uniq
params.require(:protected_branch).permit(attrs)
2016-09-13 17:45:13 +05:30
end
2014-09-02 18:07:02 +05:30
end
2019-12-21 20:55:43 +05:30
2021-06-08 01:23:25 +05:30
Projects::ProtectedBranchesController.prepend_mod_with('Projects::ProtectedBranchesController')