Commit 09f05997 authored by Rémy Coutable's avatar Rémy Coutable

Extract EE-specific code from ProjectsController

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent e515725c
......@@ -15,7 +15,6 @@ class ProjectsController < Projects::ApplicationController
before_action :project, except: [:index, :new, :create]
before_action :repository, except: [:index, :new, :create]
before_action :assign_ref_vars, only: [:show], if: :repo_exists?
before_action :assign_tree_vars, only: [:show], if: [:repo_exists?, :project_view_files?]
before_action :tree, only: [:show], if: [:repo_exists?, :project_view_files?]
before_action :lfs_blob_ids, only: [:show], if: [:repo_exists?, :project_view_files?]
before_action :project_export_enabled, only: [:export, :download_export, :remove_export, :generate_new_export]
......@@ -411,13 +410,6 @@ class ProjectsController < Projects::ApplicationController
project.repository.root_ref
end
# ExtractsPath will set @id = project.path on the show route, but it has to be the
# branch name for the tree view to work correctly.
def assign_tree_vars
@id = get_id
tree
end
def project_view_files_allowed?
!project.empty_repo? && can?(current_user, :download_code, project)
end
......
......@@ -2,12 +2,28 @@
module EE
module ProjectsController
extend ActiveSupport::Concern
extend ::Gitlab::Utils::Override
override :project_params_attributes
def project_params_attributes
super + project_params_ee
end
override :custom_import_params
def custom_import_params
custom_params = super
ci_cd_param = params.dig(:project, :ci_cd_only) || params[:ci_cd_only]
custom_params[:ci_cd_only] = ci_cd_param if ci_cd_param == 'true'
custom_params
end
override :active_new_project_tab
def active_new_project_tab
project_params[:ci_cd_only] == 'true' ? 'ci_cd_only' : super
end
private
def project_params_ee
......@@ -44,20 +60,6 @@ module EE
]
end
override :custom_import_params
def custom_import_params
custom_params = super
ci_cd_param = params.dig(:project, :ci_cd_only) || params[:ci_cd_only]
custom_params[:ci_cd_only] = ci_cd_param if ci_cd_param == 'true'
custom_params
end
override :active_new_project_tab
def active_new_project_tab
project_params[:ci_cd_only] == 'true' ? 'ci_cd_only' : super
end
def allow_mirror_params?
if @project # rubocop:disable Gitlab/ModuleWithInstanceVariables
can?(current_user, :admin_mirror, @project) # rubocop:disable Gitlab/ModuleWithInstanceVariables
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment