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
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-20 12:09:13 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-20 12:09:13 +0300
commit1ac794623a8be5dee111716a44dd04ff708f3541 (patch)
tree6c18f9fbe0bd9978bd3e8d9b083d3a0ca180686e /lib
parent5247fe0bef72fa922841a79d5dbefb47d95112fa (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r--lib/api/projects.rb14
-rw-r--r--lib/gitlab/object_hierarchy.rb2
2 files changed, 7 insertions, 9 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index 2271131ced3..6f96ffde0a7 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -267,18 +267,16 @@ module API
post ':id/fork' do
Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-foss/issues/42284')
+ not_found! unless can?(current_user, :fork_project, user_project)
+
fork_params = declared_params(include_missing: false)
- namespace_id = fork_params[:namespace]
+ fork_params[:namespace] = find_namespace!(fork_params[:namespace]) if fork_params[:namespace].present?
- if namespace_id.present?
- fork_params[:namespace] = find_namespace(namespace_id)
+ service = ::Projects::ForkService.new(user_project, current_user, fork_params)
- unless fork_params[:namespace] && can?(current_user, :create_projects, fork_params[:namespace])
- not_found!('Target Namespace')
- end
- end
+ not_found!('Target Namespace') unless service.valid_fork_target?
- forked_project = ::Projects::ForkService.new(user_project, current_user, fork_params).execute
+ forked_project = service.execute
if forked_project.errors.any?
conflict!(forked_project.errors.messages)
diff --git a/lib/gitlab/object_hierarchy.rb b/lib/gitlab/object_hierarchy.rb
index 74057bbc493..41d80fe9aa6 100644
--- a/lib/gitlab/object_hierarchy.rb
+++ b/lib/gitlab/object_hierarchy.rb
@@ -51,7 +51,7 @@ module Gitlab
# and all their ancestors (recursively).
#
# Passing an `upto` will stop the recursion once the specified parent_id is
- # reached. So all ancestors *lower* than the specified acestor will be
+ # reached. So all ancestors *lower* than the specified ancestor will be
# included.
#
# Passing a `hierarchy_order` with either `:asc` or `:desc` will cause the