Commit 4c47be30 authored by Yorick Peterse's avatar Yorick Peterse

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
parents da0efda2 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)
......
- 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
......
---
title: Fix N+1 query problem for snippets dashboard.
merge_request: 16944
author:
type: performance
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment