debian-mirror-gitlab/app/controllers/concerns/renders_projects_list.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
554 B
Ruby
Raw Normal View History

2020-07-28 23:09:34 +05:30
# frozen_string_literal: true
module RendersProjectsList
2023-06-20 00:43:36 +05:30
include RendersMemberAccess
2020-07-28 23:09:34 +05:30
def prepare_projects_for_rendering(projects)
preload_max_member_access_for_collection(Project, projects)
2023-06-20 00:43:36 +05:30
current_user.preloaded_member_roles_for_projects(projects) if current_user
2020-07-28 23:09:34 +05:30
2021-11-11 11:23:49 +05:30
# Call the count methods on every project, so the BatchLoader would load them all at
2020-07-28 23:09:34 +05:30
# once when the entities are rendered
projects.each(&:forks_count)
2021-11-11 11:23:49 +05:30
projects.each(&:open_issues_count)
2023-05-27 22:25:52 +05:30
projects.each(&:open_merge_requests_count)
2020-07-28 23:09:34 +05:30
projects
end
end