Commit 10669097 authored by Josh Frye's avatar Josh Frye

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

parent 425f8d6f
Please view this file on the master branch, on stable branches it's out of date. Please view this file on the master branch, on stable branches it's out of date.
v 8.5.0 (unreleased) v 8.5.0 (unreleased)
- Add "public" flag to GET /projects api endpoint
v 8.4.0 (unreleased) v 8.4.0 (unreleased)
- Ensure Gravatar host looks like an actual host - Ensure Gravatar host looks like an actual host
......
...@@ -29,6 +29,7 @@ GET /projects ...@@ -29,6 +29,7 @@ GET /projects
Parameters: Parameters:
- `archived` (optional) - if passed, limit by archived status - `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` - `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` - `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 - `search` (optional) - Return list of authorized projects according to a search criteria
......
...@@ -264,6 +264,10 @@ module API ...@@ -264,6 +264,10 @@ module API
projects = projects.search(params[:search]) projects = projects.search(params[:search])
end end
if params[:public].present? && parse_boolean(params[:public])
projects = projects.public_only
end
projects.reorder(project_order_by => project_sort) projects.reorder(project_order_by => project_sort)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment