summaryrefslogtreecommitdiff
path: root/lib/api/projects.rb
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-05-04 16:01:40 +0100
committerFilipa Lacerda <filipa@gitlab.com>2017-05-04 16:01:40 +0100
commit863d830427c2a30f2867d15862e4854924289c63 (patch)
tree337ce7b647f31e3d98a7c66a2c038b2fefdfe6ac /lib/api/projects.rb
parentf0329ba90ff00380e9a618c4757630f9b134eed3 (diff)
parent3441e60fd9d8d3ce111b1ece93ae867b3938f7e5 (diff)
downloadgitlab-ce-24339-job-page-step-1.tar.gz
Merge branch '24339-job-page' into 24339-job-page-step-124339-job-page-step-1
* 24339-job-page: (274 commits) Document serializers Pipeline table mini graph dropdown remains open when table is refreshed Adds off for event hub Compile gitlab-shell go executables Allow to create new branch and empty WIP merge request from issue page Moved to a view spec Improving copy of CONTRIBUTING.md, PROCESS.md, and code_review.md Convert seconds to minutes and hours on chat notifations Disable navigation to Pages config if Pages is disabled Sort the network graph both by commit date and topographically. Add breadcrumb, build header and pipelines submenu to artifacts browser Update todos screenshots removes the possibility of commit messages having carriage returns Handle incoming emails from aliases correctly Allow commenting on older versions of the diff and comparisons between diff versions Add real-time note edits :chipmunk: Move api lint out of static analysis job Fix project tree saver and fork spec failures Update ToC of CONTRIBUTING.md and PROCESS.md Improve the Code review guidelines documentation ...
Diffstat (limited to 'lib/api/projects.rb')
-rw-r--r--lib/api/projects.rb16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index db4b31b55bc..9a6cb43abf7 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -26,6 +26,10 @@ module API
params :optional_params do
use :optional_params_ce
end
+
+ params :statistics_params do
+ optional :statistics, type: Boolean, default: false, desc: 'Include project statistics'
+ end
end
resource :projects do
@@ -56,10 +60,6 @@ module API
optional :membership, type: Boolean, default: false, desc: 'Limit by projects that the current user is a member of'
end
- params :statistics_params do
- optional :statistics, type: Boolean, default: false, desc: 'Include project statistics'
- end
-
params :create_params do
optional :namespace_id, type: Integer, desc: 'Namespace ID for the new project. Default to the user namespace.'
optional :import_url, type: String, desc: 'URL from which the project is imported'
@@ -85,6 +85,7 @@ module API
end
params do
use :collection_params
+ use :statistics_params
end
get do
entity = current_user ? Entities::ProjectWithAccess : Entities::BasicProjectDetails
@@ -151,10 +152,13 @@ module API
desc 'Get a single project' do
success Entities::ProjectWithAccess
end
+ params do
+ use :statistics_params
+ end
get ":id" do
entity = current_user ? Entities::ProjectWithAccess : Entities::BasicProjectDetails
present user_project, with: entity, current_user: current_user,
- user_can_admin_project: can?(current_user, :admin_project, user_project)
+ user_can_admin_project: can?(current_user, :admin_project, user_project), statistics: params[:statistics]
end
desc 'Get events for a single project' do
@@ -381,7 +385,7 @@ module API
requires :file, type: File, desc: 'The file to be uploaded'
end
post ":id/uploads" do
- ::Projects::UploadService.new(user_project, params[:file]).execute
+ UploadService.new(user_project, params[:file]).execute
end
desc 'Get the users list of a project' do