diff options
author | Toon Claes <toon@gitlab.com> | 2017-05-24 22:12:40 +0200 |
---|---|---|
committer | Toon Claes <toon@gitlab.com> | 2017-05-30 22:45:59 +0200 |
commit | 0f0b9a8466747f69e210fc27778f96ab8ef628bc (patch) | |
tree | cfe7bea389ec5f107c4e7261879235c6700baf09 /lib/api/helpers.rb | |
parent | 01c6323d238706bc8d0acb0273552a094c996ca0 (diff) | |
download | gitlab-ce-0f0b9a8466747f69e210fc27778f96ab8ef628bc.tar.gz |
Use helper to construct Finder params
The ProjectsFinder and GroupFinder both support the same set of params. And the
`/api/v4/projects` and `/api/v4/group/:id/projects` also support the same set of
params. But they do not match the Finder params. So use a helper method to
transform them.
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r-- | lib/api/helpers.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index 2855bd7385d..17f57cfb8d7 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -264,6 +264,16 @@ module API projects.reorder(params[:order_by] => params[:sort]) end + def project_finder_params + finder_params = {} + finder_params[:non_public] = true if params[:membership].present? + finder_params[:starred] = true if params[:starred].present? + finder_params[:visibility_level] = Gitlab::VisibilityLevel.level_value(params[:visibility]) if params[:visibility] + finder_params[:archived] = params[:archived] + finder_params[:search] = params[:search] if params[:search] + finder_params + end + # file helpers def uploaded_file(field, uploads_path) |