diff options
author | Toon Claes <toon@gitlab.com> | 2017-05-26 17:31:37 +0300 |
---|---|---|
committer | Toon Claes <toon@gitlab.com> | 2017-05-30 23:45:59 +0300 |
commit | db679788e46d55984a4af71034c6db11aed919e4 (patch) | |
tree | d6fdb9d57f5156e9be56b0f583ff1a4d7c76fa57 /app/finders | |
parent | 5654ac877df5b6007606e0e1827d965bdf8e552b (diff) |
Add :owned param to ProjectFinder
And use it in the API.
Diffstat (limited to 'app/finders')
-rw-r--r-- | app/finders/projects_finder.rb | 9 |
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 |