summaryrefslogtreecommitdiff
path: root/app/finders
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2017-05-23 22:38:12 +0200
committerToon Claes <toon@gitlab.com>2017-05-30 22:45:59 +0200
commit0725050802dd30d4c235b6a2d28dd494d2d7429b (patch)
tree75d15c61638311a9bd53d291856708955e29badd /app/finders
parent8e72ad70bd2479ae5a465eac1df74f99f03ea731 (diff)
downloadgitlab-ce-0725050802dd30d4c235b6a2d28dd494d2d7429b.tar.gz
Change ProjectFinder so starred can be combined with other filters
The `starred` parameter couldn't be used in combination with `trending` or `non_public`. But this is changed now.
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/projects_finder.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/app/finders/projects_finder.rb b/app/finders/projects_finder.rb
index f6d8226bf3f..588406982d7 100644
--- a/app/finders/projects_finder.rb
+++ b/app/finders/projects_finder.rb
@@ -31,6 +31,7 @@ class ProjectsFinder < UnionFinder
items = by_ids(items)
items = union(items)
items = by_personal(items)
+ items = by_starred(items)
items = by_visibilty_level(items)
items = by_tags(items)
items = by_search(items)
@@ -45,8 +46,6 @@ class ProjectsFinder < UnionFinder
if params[:trending].present?
projects << Project.trending
- elsif params[:starred].present? && current_user
- projects << current_user.viewable_starred_projects
else
projects << current_user.authorized_projects if current_user
projects << Project.unscoped.public_to_user(current_user) unless params[:non_public].present?
@@ -67,6 +66,10 @@ class ProjectsFinder < UnionFinder
(params[:personal].present? && current_user) ? items.personal(current_user) : items
end
+ def by_starred(items)
+ (params[:starred].present? && current_user) ? items.starred_by(current_user) : items
+ end
+
def by_visibilty_level(items)
params[:visibility_level].present? ? items.where(visibility_level: params[:visibility_level]) : items
end