Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
eea1b885
Commit
eea1b885
authored
Sep 05, 2018
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly fix an introduced N+1 SQL issue loading commit authors
parent
43859f59
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
6 deletions
+4
-6
app/controllers/projects/refs_controller.rb
app/controllers/projects/refs_controller.rb
+3
-0
app/models/commit.rb
app/models/commit.rb
+1
-6
No files found.
app/controllers/projects/refs_controller.rb
View file @
eea1b885
...
@@ -70,6 +70,9 @@ class Projects::RefsController < Projects::ApplicationController
...
@@ -70,6 +70,9 @@ class Projects::RefsController < Projects::ApplicationController
end
end
def
prerender_commit_full_titles!
(
commits
)
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
=
Banzai
::
ObjectRenderer
.
new
(
user:
current_user
,
default_project:
@project
)
renderer
.
render
(
commits
,
:full_title
)
renderer
.
render
(
commits
,
:full_title
)
end
end
...
...
app/models/commit.rb
View file @
eea1b885
...
@@ -39,12 +39,7 @@ class Commit
...
@@ -39,12 +39,7 @@ class Commit
def
banzai_render_context
(
field
)
def
banzai_render_context
(
field
)
pipeline
=
field
==
:description
?
:commit_description
:
:single_line
pipeline
=
field
==
:description
?
:commit_description
:
:single_line
context
=
{
pipeline:
pipeline
,
project:
self
.
project
}
context
=
{
pipeline:
pipeline
,
project:
self
.
project
}
context
[
:author
]
=
self
.
author
if
self
.
author
# The author is only needed when rendering the description
if
field
==
:description
author
=
self
.
author
context
[
:author
]
=
author
if
author
end
context
context
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment