summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-09-20 09:51:00 +0000
committerRémy Coutable <remy@rymai.me>2017-09-20 09:51:00 +0000
commitd247841b48c6ad5b3891671e30bedeb409bfad30 (patch)
tree1b90239c8d63574be3df6965f7fcc544fd749221 /lib/api
parent36dc65d5ca34234faf8e79106ed081a28659d899 (diff)
parentc9d40927f877a9d4896edcd94c8525ba8eba3ffd (diff)
downloadgitlab-ce-d247841b48c6ad5b3891671e30bedeb409bfad30.tar.gz
Merge branch '20049-projects-api-forks' into 'master'
Resolve "make project data via API report forks of this project" Closes #20049 See merge request gitlab-org/gitlab-ce!14355
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/projects.rb23
1 files changed, 19 insertions, 4 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index 7dc19788462..aab7a6c3f93 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -70,8 +70,11 @@ module API
optional :import_url, type: String, desc: 'URL from which the project is imported'
end
- def present_projects(options = {})
- projects = ProjectsFinder.new(current_user: current_user, params: project_finder_params).execute
+ def load_projects
+ ProjectsFinder.new(current_user: current_user, params: project_finder_params).execute
+ end
+
+ def present_projects(projects, options = {})
projects = reorder_projects(projects)
projects = projects.with_statistics if params[:statistics]
projects = projects.with_issues_enabled if params[:with_issues_enabled]
@@ -111,7 +114,7 @@ module API
params[:user] = user
- present_projects
+ present_projects load_projects
end
end
@@ -124,7 +127,7 @@ module API
use :statistics_params
end
get do
- present_projects
+ present_projects load_projects
end
desc 'Create new project' do
@@ -229,6 +232,18 @@ module API
end
end
+ desc 'List forks of this project' do
+ success Entities::Project
+ end
+ params do
+ use :collection_params
+ end
+ get ':id/forks' do
+ forks = ForkProjectsFinder.new(user_project, params: project_finder_params, current_user: current_user).execute
+
+ present_projects forks
+ end
+
desc 'Update an existing project' do
success Entities::Project
end