diff options
author | Sasha Joseph <sasha@fuzzproductions.com> | 2014-07-28 01:01:01 -0400 |
---|---|---|
committer | Sasha Joseph <sasha@fuzzproductions.com> | 2014-07-28 12:48:13 -0400 |
commit | 37c4ba6f8d8b6be9f15bd0df701c64eea9c4d8e4 (patch) | |
tree | ecdc0db00ff1f15d49cc7456fd3d4ce17bf7f881 /lib/api/projects.rb | |
parent | 00c6723883671769f6efd692f935dc3203d7ccc6 (diff) | |
download | gitlab-ce-37c4ba6f8d8b6be9f15bd0df701c64eea9c4d8e4.tar.gz |
Add an option to GET /projects in the GitLab API to exclude archived projects
Diffstat (limited to 'lib/api/projects.rb')
-rw-r--r-- | lib/api/projects.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb index ab272426ce0..27869e49f71 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -7,7 +7,7 @@ module API helpers do def map_public_to_visibility_level(attrs) publik = attrs.delete(:public) - publik = [ true, 1, '1', 't', 'T', 'true', 'TRUE', 'on', 'ON' ].include?(publik) + publik = parse_boolean(publik) attrs[:visibility_level] = Gitlab::VisibilityLevel::PUBLIC if !attrs[:visibility_level].present? && publik == true attrs end @@ -15,10 +15,18 @@ module API # Get a projects list for authenticated user # + # Parameters: + # archived (optional) - if passed, limit by archived status + # # Example Request: # GET /projects get do - @projects = paginate current_user.authorized_projects + @query = current_user.authorized_projects + # If the archived parameter is passed, limit results accordingly + if params[:archived].present? + @query = @query.where(archived: parse_boolean(params[:archived])) + end + @projects = paginate @query present @projects, with: Entities::Project end |