Properly fix an introduced N+1 SQL issue loading commit authors
This commit is contained in:
parent
43859f59ae
commit
eea1b88547
2 changed files with 4 additions and 6 deletions
|
@ -70,6 +70,9 @@ class Projects::RefsController < Projects::ApplicationController
|
|||
end
|
||||
|
||||
def prerender_commit_full_titles!(commits)
|
||||
# Preload commit authors as they are used in rendering
|
||||
commits.each(&:lazy_author)
|
||||
|
||||
renderer = Banzai::ObjectRenderer.new(user: current_user, default_project: @project)
|
||||
renderer.render(commits, :full_title)
|
||||
end
|
||||
|
|
|
@ -39,12 +39,7 @@ class Commit
|
|||
def banzai_render_context(field)
|
||||
pipeline = field == :description ? :commit_description : :single_line
|
||||
context = { pipeline: pipeline, project: self.project }
|
||||
|
||||
# The author is only needed when rendering the description
|
||||
if field == :description
|
||||
author = self.author
|
||||
context[:author] = author if author
|
||||
end
|
||||
context[:author] = self.author if self.author
|
||||
|
||||
context
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue