summaryrefslogtreecommitdiff
path: root/lib/api/helpers.rb
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2017-05-26 16:31:37 +0200
committerToon Claes <toon@gitlab.com>2017-05-30 22:45:59 +0200
commitdb679788e46d55984a4af71034c6db11aed919e4 (patch)
treed6fdb9d57f5156e9be56b0f583ff1a4d7c76fa57 /lib/api/helpers.rb
parent5654ac877df5b6007606e0e1827d965bdf8e552b (diff)
downloadgitlab-ce-db679788e46d55984a4af71034c6db11aed919e4.tar.gz
Add :owned param to ProjectFinder
And use it in the API.
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r--lib/api/helpers.rb7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index 17f57cfb8d7..d61450f8258 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -256,16 +256,13 @@ module API
# project helpers
- def filter_projects(projects)
- if params[:owned]
- projects = projects.merge(current_user.owned_projects)
- end
-
+ def reorder_projects(projects)
projects.reorder(params[:order_by] => params[:sort])
end
def project_finder_params
finder_params = {}
+ finder_params[:owned] = true if params[:owned].present?
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]