Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2017-05-26 17:31:37 +0300
committerToon Claes <toon@gitlab.com>2017-05-30 23:45:59 +0300
commitdb679788e46d55984a4af71034c6db11aed919e4 (patch)
treed6fdb9d57f5156e9be56b0f583ff1a4d7c76fa57 /app/finders/projects_finder.rb
parent5654ac877df5b6007606e0e1827d965bdf8e552b (diff)
Add :owned param to ProjectFinder
And use it in the API.
Diffstat (limited to 'app/finders/projects_finder.rb')
-rw-r--r--app/finders/projects_finder.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/finders/projects_finder.rb b/app/finders/projects_finder.rb
index 866d95ea1d7..5bf722d1ec6 100644
--- a/app/finders/projects_finder.rb
+++ b/app/finders/projects_finder.rb
@@ -7,6 +7,7 @@
# project_ids_relation: int[] - project ids to use
# params:
# trending: boolean
+# owned: boolean
# non_public: boolean
# starred: boolean
# sort: string
@@ -47,8 +48,12 @@ class ProjectsFinder < UnionFinder
def init_collection
projects = []
- projects << current_user.authorized_projects if current_user
- projects << Project.unscoped.public_to_user(current_user) unless params[:non_public].present?
+ if params[:owned].present?
+ projects << current_user.owned_projects if current_user
+ else
+ projects << current_user.authorized_projects if current_user
+ projects << Project.unscoped.public_to_user(current_user) unless params[:non_public].present?
+ end
projects
end