summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-05-31 19:07:27 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-05-31 19:07:27 +0800
commitafc1fac03915f6e9df28fb3932093f73f01e3934 (patch)
treec1caac8fd996883c6fe06c40d715f5a7600c3981 /lib/api
parentb5e8de5c4c202d10ef8b48248b12f49c1330d04a (diff)
parent228926daee799c95e752a3c284c860e5bc60e528 (diff)
downloadgitlab-ce-afc1fac03915f6e9df28fb3932093f73f01e3934.tar.gz
Merge remote-tracking branch 'upstream/master' into 24196-protected-variables
* upstream/master: (89 commits) Revert "Merge branch 'grpc-1.3.4' into 'master'" Return nil when looking up config for unknown LDAP provider Avoid crash when trying to parse string with invalid UTF-8 sequence Enable Gitaly by default in GitLab 9.3 Don’t create comment on JIRA if link already exists Disable sub_group_issuables_spec.rb for mysql Fix math rendering on blob pages Add changelog Don't allow to pass a user to ProjectWiki#http_url_to_repo Revert "Merge branch '1937-https-clone-url-username' into 'master' " Fix bottom padding for build page Fix /unsubscribe slash command creating extra todos Fix omniauth-google-oauth2 dependencies in Gemfile.lock Update looks job log 'New issue'/'New merge request' dropdowns should show only projects with issues/merge requests feature enabled Fix spec for Members::AuthorizedDestroyService 31616-add-uptime-of-gitlab-instance-in-admin-area Set head pipeline when creating merge requests Create a separate helper to check if we show particular tab on a search page Add performance deltas between app deployments on Merge Request widget ...
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/entities.rb5
-rw-r--r--lib/api/groups.rb6
-rw-r--r--lib/api/projects.rb8
-rw-r--r--lib/api/v3/entities.rb5
-rw-r--r--lib/api/v3/groups.rb6
5 files changed, 25 insertions, 5 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 936f3283877..2e2b95b7994 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -152,7 +152,10 @@ module API
expose :web_url
expose :request_access_enabled
expose :full_name, :full_path
- expose :parent_id
+
+ if ::Group.supports_nested_groups?
+ expose :parent_id
+ end
expose :statistics, if: :statistics do
with_options format_with: -> (value) { value.to_i } do
diff --git a/lib/api/groups.rb b/lib/api/groups.rb
index 3da7d735da8..ee85b777aff 100644
--- a/lib/api/groups.rb
+++ b/lib/api/groups.rb
@@ -70,7 +70,11 @@ module API
params do
requires :name, type: String, desc: 'The name of the group'
requires :path, type: String, desc: 'The path of the group'
- optional :parent_id, type: Integer, desc: 'The parent group id for creating nested group'
+
+ if ::Group.supports_nested_groups?
+ optional :parent_id, type: Integer, desc: 'The parent group id for creating nested group'
+ end
+
use :optional_params
end
post do
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index ed5004e8d1a..d4fe5c023bf 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -58,6 +58,8 @@ module API
optional :owned, type: Boolean, default: false, desc: 'Limit by owned by authenticated user'
optional :starred, type: Boolean, default: false, desc: 'Limit by starred status'
optional :membership, type: Boolean, default: false, desc: 'Limit by projects that the current user is a member of'
+ optional :with_issues_enabled, type: Boolean, default: false, desc: 'Limit by enabled issues feature'
+ optional :with_merge_requests_enabled, type: Boolean, default: false, desc: 'Limit by enabled merge requests feature'
end
params :create_params do
@@ -69,11 +71,15 @@ module API
options = options.reverse_merge(
with: Entities::Project,
current_user: current_user,
- simple: params[:simple]
+ simple: params[:simple],
+ with_issues_enabled: params[:with_issues_enabled],
+ with_merge_requests_enabled: params[:with_merge_requests_enabled]
)
projects = filter_projects(projects)
projects = projects.with_statistics if options[:statistics]
+ projects = projects.with_issues_enabled if options[:with_issues_enabled]
+ projects = projects.with_merge_requests_enabled if options[:with_merge_requests_enabled]
options[:with] = Entities::BasicProjectDetails if options[:simple]
present paginate(projects), options
diff --git a/lib/api/v3/entities.rb b/lib/api/v3/entities.rb
index 332f233bf5e..2e1b243c2db 100644
--- a/lib/api/v3/entities.rb
+++ b/lib/api/v3/entities.rb
@@ -137,7 +137,10 @@ module API
expose :web_url
expose :request_access_enabled
expose :full_name, :full_path
- expose :parent_id
+
+ if ::Group.supports_nested_groups?
+ expose :parent_id
+ end
expose :statistics, if: :statistics do
with_options format_with: -> (value) { value.to_i } do
diff --git a/lib/api/v3/groups.rb b/lib/api/v3/groups.rb
index 6187445fc8d..2c52d21fa1c 100644
--- a/lib/api/v3/groups.rb
+++ b/lib/api/v3/groups.rb
@@ -74,7 +74,11 @@ module API
params do
requires :name, type: String, desc: 'The name of the group'
requires :path, type: String, desc: 'The path of the group'
- optional :parent_id, type: Integer, desc: 'The parent group id for creating nested group'
+
+ if ::Group.supports_nested_groups?
+ optional :parent_id, type: Integer, desc: 'The parent group id for creating nested group'
+ end
+
use :optional_params
end
post do