summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-06-22 05:22:14 +0000
committerRémy Coutable <remy@rymai.me>2017-06-22 05:22:14 +0000
commitafbb93f72c7f83d78d1a2e07c22f70aded6389f6 (patch)
tree9ae62c04ed57764f13e64a286ed9e6c3b89e34d7 /lib
parent2b2c973f028825c95abf03ddbd42ee65854714e0 (diff)
parenteda30f31041d883787959823b95c0ebef3c762ef (diff)
downloadgitlab-ce-afbb93f72c7f83d78d1a2e07c22f70aded6389f6.tar.gz
Merge branch '32301-filter-archive-project-on-param-present' into 'master'
Filter archived project in API only if param present Closes #32301 See merge request !12245
Diffstat (limited to 'lib')
-rw-r--r--lib/api/v3/helpers.rb5
-rw-r--r--lib/api/v3/projects.rb2
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/api/v3/helpers.rb b/lib/api/v3/helpers.rb
index d9e76560d03..4e63aa01c1a 100644
--- a/lib/api/v3/helpers.rb
+++ b/lib/api/v3/helpers.rb
@@ -38,7 +38,10 @@ module API
projects = projects.where(visibility_level: Gitlab::VisibilityLevel.level_value(params[:visibility]))
end
- projects = projects.where(archived: params[:archived])
+ unless params[:archived].nil?
+ projects = projects.where(archived: to_boolean(params[:archived]))
+ end
+
projects.reorder(params[:order_by] => params[:sort])
end
end
diff --git a/lib/api/v3/projects.rb b/lib/api/v3/projects.rb
index 20976b9dd08..eb090453b48 100644
--- a/lib/api/v3/projects.rb
+++ b/lib/api/v3/projects.rb
@@ -69,7 +69,7 @@ module API
end
params :filter_params do
- optional :archived, type: Boolean, default: false, desc: 'Limit by archived status'
+ optional :archived, type: Boolean, default: nil, desc: 'Limit by archived status'
optional :visibility, type: String, values: %w[public internal private],
desc: 'Limit by visibility'
optional :search, type: String, desc: 'Return list of authorized projects matching the search criteria'