diff options
author | Douwe Maan <douwe@gitlab.com> | 2019-02-25 14:24:13 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2019-02-25 14:24:13 +0300 |
commit | 8cb236908f03cba6f6a1ad5660ce8fbdfa32a50d (patch) | |
tree | 9b4b4215780394c2b4c4f339b154250be6ae3eeb /app | |
parent | e5c7027faffb75f1d2f7221fa11609741010d82f (diff) | |
parent | 99633a8fa387037697cb0faa04da40972dcc58cc (diff) |
Merge branch '40795-set-project-name-on-fork-api' into 'master'
Add ability to set project path and name on fork using API
Closes #40795
See merge request gitlab-org/gitlab-ce!25363
Diffstat (limited to 'app')
-rw-r--r-- | app/services/projects/fork_service.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/app/services/projects/fork_service.rb b/app/services/projects/fork_service.rb index 91091c4393d..fc234bafc57 100644 --- a/app/services/projects/fork_service.rb +++ b/app/services/projects/fork_service.rb @@ -38,8 +38,8 @@ module Projects new_params = { visibility_level: allowed_visibility_level, description: @project.description, - name: @project.name, - path: @project.path, + name: target_name, + path: target_path, shared_runners_enabled: @project.shared_runners_enabled, namespace_id: target_namespace.id, fork_network: fork_network, @@ -94,6 +94,14 @@ module Projects Projects::ForksCountService.new(@project).refresh_cache end + def target_path + @target_path ||= @params[:path] || @project.path + end + + def target_name + @target_name ||= @params[:name] || @project.name + end + def target_namespace @target_namespace ||= @params[:namespace] || current_user.namespace end |