diff options
author | Jan <king-jan1999@hotmail.de> | 2018-03-26 09:22:03 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-03-26 09:22:03 +0000 |
commit | 54baf3a362e853f3d704b6936fb7a2c4aebd5956 (patch) | |
tree | a27b51b35411c887d8d5965f533fd83444a1d9b9 /lib | |
parent | bf2727564800adc5b2a7c31a7e8241a392fc673d (diff) | |
download | gitlab-ce-54baf3a362e853f3d704b6936fb7a2c4aebd5956.tar.gz |
Resolve "Forking with namespace doesn't work (API)"
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/projects.rb | 6 | ||||
-rw-r--r-- | lib/api/v3/projects.rb | 6 |
2 files changed, 2 insertions, 10 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb index b552b0e0c5d..467bc78dad8 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -228,11 +228,7 @@ module API namespace_id = fork_params[:namespace] if namespace_id.present? - fork_params[:namespace] = if namespace_id =~ /^\d+$/ - Namespace.find_by(id: namespace_id) - else - Namespace.find_by_path_or_name(namespace_id) - end + fork_params[:namespace] = find_namespace(namespace_id) unless fork_params[:namespace] && can?(current_user, :create_projects, fork_params[:namespace]) not_found!('Target Namespace') diff --git a/lib/api/v3/projects.rb b/lib/api/v3/projects.rb index 7d8b1f369fe..a2df969d819 100644 --- a/lib/api/v3/projects.rb +++ b/lib/api/v3/projects.rb @@ -268,11 +268,7 @@ module API namespace_id = fork_params[:namespace] if namespace_id.present? - fork_params[:namespace] = if namespace_id =~ /^\d+$/ - Namespace.find_by(id: namespace_id) - else - Namespace.find_by_path_or_name(namespace_id) - end + fork_params[:namespace] = find_namespace(namespace_id) unless fork_params[:namespace] && can?(current_user, :create_projects, fork_params[:namespace]) not_found!('Target Namespace') |