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
Boxiang Sun
gitlab-ce
Commits
f7c30ae3
Commit
f7c30ae3
authored
Feb 06, 2018
by
Andreas Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix N+1 query problem for snippets dashboard.
Closes #40755.
parent
b9d547b1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
2 deletions
+7
-2
app/finders/snippets_finder.rb
app/finders/snippets_finder.rb
+1
-1
app/views/shared/snippets/_snippet.html.haml
app/views/shared/snippets/_snippet.html.haml
+1
-1
changelogs/unreleased/40755-snippets-author-n-1.yml
changelogs/unreleased/40755-snippets-author-n-1.yml
+5
-0
No files found.
app/finders/snippets_finder.rb
View file @
f7c30ae3
...
...
@@ -28,7 +28,7 @@ class SnippetsFinder < UnionFinder
segments
<<
items
.
public_to_user
(
current_user
)
segments
<<
authorized_to_user
(
items
)
if
current_user
find_union
(
segments
,
Snippet
)
find_union
(
segments
,
Snippet
.
includes
(
:author
)
)
end
def
authorized_to_user
(
items
)
...
...
app/views/shared/snippets/_snippet.html.haml
View file @
f7c30ae3
-
link_project
=
local_assigns
.
fetch
(
:link_project
,
false
)
%li
.snippet-row
=
image_tag
avatar_icon
(
snippet
.
author
_email
),
class:
"avatar s40 hidden-xs"
,
alt:
''
=
image_tag
avatar_icon
(
snippet
.
author
),
class:
"avatar s40 hidden-xs"
,
alt:
''
.title
=
link_to
reliable_snippet_path
(
snippet
)
do
...
...
changelogs/unreleased/40755-snippets-author-n-1.yml
0 → 100644
View file @
f7c30ae3
---
title
:
Fix N+1 query problem for snippets dashboard.
merge_request
:
16944
author
:
type
:
performance
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