Add public params to GET /projects api. Closes #3788

This commit is contained in:
Josh Frye 2016-01-13 09:07:21 -05:00
parent 425f8d6f57
commit 10669097fa
3 changed files with 6 additions and 0 deletions

View File

@ -1,6 +1,7 @@
Please view this file on the master branch, on stable branches it's out of date.
v 8.5.0 (unreleased)
- Add "public" flag to GET /projects api endpoint
v 8.4.0 (unreleased)
- Ensure Gravatar host looks like an actual host

View File

@ -29,6 +29,7 @@ GET /projects
Parameters:
- `archived` (optional) - if passed, limit by archived status
- `public` (optional) - if passed, limit by public visibility
- `order_by` (optional) - Return requests ordered by `id`, `name`, `path`, `created_at`, `updated_at` or `last_activity_at` fields. Default is `created_at`
- `sort` (optional) - Return requests sorted in `asc` or `desc` order. Default is `desc`
- `search` (optional) - Return list of authorized projects according to a search criteria

View File

@ -264,6 +264,10 @@ module API
projects = projects.search(params[:search])
end
if params[:public].present? && parse_boolean(params[:public])
projects = projects.public_only
end
projects.reorder(project_order_by => project_sort)
end