summaryrefslogtreecommitdiff
path: root/lib/api/projects.rb
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2017-05-23 22:40:39 +0200
committerToon Claes <toon@gitlab.com>2017-05-30 22:45:59 +0200
commita1deed629e03d8db47deb1bcf795ae8abaf2c847 (patch)
tree2c64d41673e7d8d061839ea13c1897f14aa43915 /lib/api/projects.rb
parent0725050802dd30d4c235b6a2d28dd494d2d7429b (diff)
downloadgitlab-ce-a1deed629e03d8db47deb1bcf795ae8abaf2c847.tar.gz
Use ProjectFinder to filter the projects
Instead of trying to do the heavy lifting in the API itself, use the existing features of the ProjectFinder.
Diffstat (limited to 'lib/api/projects.rb')
-rw-r--r--lib/api/projects.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index bb03480f1ee..7610e3cbacc 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -70,6 +70,10 @@ module API
def present_projects(options = {})
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]
projects = ProjectsFinder.new(current_user: current_user, params: finder_params).execute
projects = filter_projects(projects)