diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2018-03-05 14:05:54 +0300 |
---|---|---|
committer | Ian Baum <ibaum@gitlab.com> | 2018-03-07 01:22:45 +0300 |
commit | 6b94f83df2fd467a1141e1be841998ed01f1c2ad (patch) | |
tree | 080e8faf5138b73f76862086a0c80a61a2da28fc /app/finders | |
parent | d00802fa1ed1729e8ef0a485e62a5ef9ac84e990 (diff) |
Merge branch 'remove-projects-finder-from-todos-finder' into 'master'
Don't use ProjectsFinder in TodosFinder
Closes #43767
See merge request gitlab-org/gitlab-ce!17462
Diffstat (limited to 'app/finders')
-rw-r--r-- | app/finders/todos_finder.rb | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/app/finders/todos_finder.rb b/app/finders/todos_finder.rb index 3502bf08971..f07fb1c064d 100644 --- a/app/finders/todos_finder.rb +++ b/app/finders/todos_finder.rb @@ -105,10 +105,6 @@ class TodosFinder ids end - def projects(items) - ProjectsFinder.new(current_user: current_user, project_ids_relation: project_ids(items)).execute - end - def type? type.present? && %w(Issue MergeRequest).include?(type) end @@ -147,13 +143,14 @@ class TodosFinder def by_project(items) if project? - items = items.where(project: project) + items.where(project: project) else - item_projects = projects(items) - items = items.merge(item_projects).joins(:project) - end + projects = Project + .public_or_visible_to_user(current_user) + .order_id_desc - items + items.joins(:project).merge(projects) + end end def by_state(items) |