gitlab-org--gitlab-foss/app/finders
Yorick Peterse d6a8021ea1 Scope issue projects to a Group when possible
When using IssuableFinder with a Group we can greatly reduce the amount
of projects operated on (due to not including all public/internal
projects) by simply passing it down to the ProjectsFinder class.

This reduces the timings of the involved queries from roughly 300
ms to roughly 20 ms.

Fixes gitlab-org/gitlab-ce#4071, gitlab-org/gitlab-ce#3707
2016-01-18 12:27:33 +01:00
..
contributed_projects_finder.rb
issuable_finder.rb Scope issue projects to a Group when possible 2016-01-18 12:27:33 +01:00
issues_finder.rb
merge_requests_finder.rb
milestones_finder.rb
notes_finder.rb
personal_projects_finder.rb
projects_finder.rb
README.md
snippets_finder.rb
trending_projects_finder.rb

Finders

This type of classes responsible for collection items based on different conditions. To prevent lookup methods in models like this:

class Project
  def issues_for_user_filtered_by(user, filter)
    # A lot of logic not related to project model itself
  end
end

issues = project.issues_for_user_filtered_by(user, params)

Better use this:

issues = IssuesFinder.new(project, user, filter).execute

It will help keep models thiner.