diff options
author | Balasankar "Balu" C <balasankar@gitlab.com> | 2019-02-18 17:17:29 +0300 |
---|---|---|
committer | Balasankar "Balu" C <balasankar@gitlab.com> | 2019-02-19 21:49:27 +0300 |
commit | 39f77ad9b46d78908531a303e8a237b40fd07e7e (patch) | |
tree | e150a5983595d0b415c6324e81fe7fd8bf8efeb7 /app/services/projects/fork_service.rb | |
parent | ab9f8785ebf5483e5d2cd02497b57fa05a47561e (diff) |
Let users set name/path on project fork using API
Diffstat (limited to 'app/services/projects/fork_service.rb')
-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 |