diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2018-02-07 14:52:14 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2018-02-07 14:52:14 +0300 |
commit | 4c47be304c0878d5a9fd4d81b902a1cacf12ecf2 (patch) | |
tree | 488eefd1340269fb40d24eb714db59555b30a41c /app | |
parent | da0efda2ecb51c6358bf73bd85cef5a883be402e (diff) | |
parent | f7c30ae30d878de3980f65a2c3353503a440a615 (diff) |
Merge branch '40755-snippets-author-n+1' into 'master'
Resolve "N+1 database queries on the snippets dashboard"
Closes #40755
See merge request gitlab-org/gitlab-ce!16944
Diffstat (limited to 'app')
-rw-r--r-- | app/finders/snippets_finder.rb | 2 | ||||
-rw-r--r-- | app/views/shared/snippets/_snippet.html.haml | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/app/finders/snippets_finder.rb b/app/finders/snippets_finder.rb index c04f61de79c..4450766485f 100644 --- a/app/finders/snippets_finder.rb +++ b/app/finders/snippets_finder.rb @@ -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) diff --git a/app/views/shared/snippets/_snippet.html.haml b/app/views/shared/snippets/_snippet.html.haml index 7388f20a9fd..57b445321e2 100644 --- a/app/views/shared/snippets/_snippet.html.haml +++ b/app/views/shared/snippets/_snippet.html.haml @@ -1,7 +1,7 @@ - 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 |