diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2018-03-05 11:05:54 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2018-03-05 11:05:54 +0000 |
commit | d50caa64f8701bdd0520eee5f9e8ad6755e2601b (patch) | |
tree | 95baf8869ed32ba9c4936b4e226e0449ea6742e5 | |
parent | 67feb7cd42e439e754d64fce646d8d9fb99a0ad8 (diff) | |
parent | f09fe848da02189a3dafe2d532fefb1379eacac4 (diff) | |
download | gitlab-ce-d50caa64f8701bdd0520eee5f9e8ad6755e2601b.tar.gz |
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
-rw-r--r-- | app/finders/todos_finder.rb | 15 | ||||
-rw-r--r-- | changelogs/unreleased/remove-projects-finder-from-todos-finder.yml | 5 |
2 files changed, 11 insertions, 9 deletions
diff --git a/app/finders/todos_finder.rb b/app/finders/todos_finder.rb index edb17843002..47c8b9b60ed 100644 --- a/app/finders/todos_finder.rb +++ b/app/finders/todos_finder.rb @@ -110,10 +110,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 @@ -152,13 +148,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) diff --git a/changelogs/unreleased/remove-projects-finder-from-todos-finder.yml b/changelogs/unreleased/remove-projects-finder-from-todos-finder.yml new file mode 100644 index 00000000000..0a3fc751edb --- /dev/null +++ b/changelogs/unreleased/remove-projects-finder-from-todos-finder.yml @@ -0,0 +1,5 @@ +--- +title: Don't use ProjectsFinder in TodosFinder +merge_request: +author: +type: performance |