diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2019-08-31 23:20:19 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2019-09-06 16:43:33 +0800 |
commit | 3cbfd0be8ca1bb65f9bc2f017517bb2806fb3c4c (patch) | |
tree | 2c92d8fee09e57d9eb4526d04608c3a6da1cd613 /app/finders/issuable_finder.rb | |
parent | 866465f6985d889c02a922a9b02c0803bb0be840 (diff) | |
download | gitlab-ce-3cbfd0be8ca1bb65f9bc2f017517bb2806fb3c4c.tar.gz |
Add projects parameter to IssuableFinder
Diffstat (limited to 'app/finders/issuable_finder.rb')
-rw-r--r-- | app/finders/issuable_finder.rb | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb index b735f9ff3b8..8ed6ff56e2b 100644 --- a/app/finders/issuable_finder.rb +++ b/app/finders/issuable_finder.rb @@ -193,15 +193,30 @@ class IssuableFinder projects = if current_user && params[:authorized_only].presence && !current_user_related? current_user.authorized_projects(min_access_level) - elsif group - find_group_projects else - Project.public_or_visible_to_user(current_user, min_access_level) + projects_public_or_visible_to_user end @projects = projects.with_feature_available_for_user(klass, current_user).reorder(nil) # rubocop: disable CodeReuse/ActiveRecord end + def projects_public_or_visible_to_user + projects = + if group + if params[:projects] + find_group_projects.id_in(params[:projects]) + else + find_group_projects + end + elsif params[:projects] + Project.id_in(params[:projects]) + else + Project + end + + projects.public_or_visible_to_user(current_user, min_access_level) + end + def find_group_projects return Project.none unless group @@ -209,7 +224,7 @@ class IssuableFinder Project.where(namespace_id: group.self_and_descendants) # rubocop: disable CodeReuse/ActiveRecord else group.projects - end.public_or_visible_to_user(current_user, min_access_level) + end end def search |