Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/projects/forks_controller.rb')
-rw-r--r--app/controllers/projects/forks_controller.rb16
1 files changed, 12 insertions, 4 deletions
diff --git a/app/controllers/projects/forks_controller.rb b/app/controllers/projects/forks_controller.rb
index 33f046f414f..9fc8e8c063b 100644
--- a/app/controllers/projects/forks_controller.rb
+++ b/app/controllers/projects/forks_controller.rb
@@ -7,7 +7,7 @@ class Projects::ForksController < Projects::ApplicationController
include Gitlab::Utils::StrongMemoize
# Authorize
- before_action :whitelist_query_limiting, only: [:create]
+ before_action :disable_query_limiting, only: [:create]
before_action :require_non_empty_project
before_action :authorize_download_code!
before_action :authenticate_user!, only: [:new, :create]
@@ -44,13 +44,17 @@ class Projects::ForksController < Projects::ApplicationController
def new
respond_to do |format|
format.html do
- @own_namespace = current_user.namespace if fork_service.valid_fork_targets.include?(current_user.namespace)
+ @own_namespace = current_user.namespace if can_fork_to?(current_user.namespace)
@project = project
end
format.json do
namespaces = load_namespaces_with_associations - [project.namespace]
+ namespaces = [current_user.namespace] + namespaces if
+ Feature.enabled?(:fork_project_form, project, default_enabled: :yaml) &&
+ can_fork_to?(current_user.namespace)
+
render json: {
namespaces: ForkNamespaceSerializer.new.represent(namespaces, project: project, current_user: current_user, memberships: memberships_hash)
}
@@ -78,6 +82,10 @@ class Projects::ForksController < Projects::ApplicationController
private
+ def can_fork_to?(namespace)
+ ForkTargetsFinder.new(@project, current_user).execute.id_in(current_user.namespace).any?
+ end
+
def load_forks
forks = ForkProjectsFinder.new(
project,
@@ -110,8 +118,8 @@ class Projects::ForksController < Projects::ApplicationController
access_denied! unless fork_namespace && fork_service.valid_fork_target?
end
- def whitelist_query_limiting
- Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-foss/issues/42335')
+ def disable_query_limiting
+ Gitlab::QueryLimiting.disable!('https://gitlab.com/gitlab-org/gitlab/-/issues/20783')
end
def load_namespaces_with_associations